HTTP utilities and transports - mushroom.http

Request and response

class mushroom.http.HttpRequest(environ)
class mushroom.http.HttpResponse(code='200 OK', content='', extra_headers=None)
class mushroom.http.JsonResponse(data)

Exceptions

class mushroom.http.HttpError(message=None)
code = ''
headers = {}
message = ''
class mushroom.http.HttpUnauthorized(auth_scheme=None)
code = '401 Unauthorized'
class mushroom.http.HttpNotFound(message=None)
code = '404 Not Found'
class mushroom.http.HttpMethodNotAllowed(allowed_methods)
code = '405 Method Not Allowed'
class mushroom.http.HttpInternalServerError(message=None)
code = '500 Internal Server Error'
class mushroom.http.HttpNotImplemented(message=None)
code = '501 Not Implemented'

Transports

class mushroom.http.HttpTransport
get_url(protocol, request, session)
handle_http_request(request, session)
class mushroom.http.PollTransport
get_handshake_data(request, session)
handle_disconnect(reconnect=False)
handle_http_request(request, session)
name = 'poll'
real_send(message)

Perform the actual send operation. This method is only called internally and should not be called from application code. This method is transport specific and must be overwritten.

timeout = 40
class mushroom.http.WebSocketTransport
get_handshake_data(request, session)
handle_disconnect()
handle_http_request(request, session)
handle_message(message)
name = 'ws'
real_send(message)

Perform the actual send operation. This method is only called internally and should not be called from application code. This method is transport specific and must be overwritten.