minos.networks.http.requests

Classes

HttpRequest

Http Request class.

HttpResponse

Http Response class.

Exceptions

HttpResponseException

Http Response Exception class.

class HttpRequest[source]

Bases: Request, ABC

Http Request class.

user

Returns the UUID of the user making the Request.

abstract property headers: dict[str, str]

Get the headers of the request.

Returns

A dictionary in which keys are str instances and values are str instances.

abstract property content_type: str

Get the content type.

Returns

A str value.

abstract async url_params(type_=None, **kwargs)[source]

Get the url params.

Parameters
  • type – Optional type or str (classname) that defines the request content type.

  • kwargs – Additional named arguments.

  • type_ (Optional[Union[type, str]]) –

Returns

A dictionary instance.

Return type

Any

abstract property has_url_params: bool

Check if the request has url params.

Returns

True if it has url params or False otherwise.

abstract async query_params(type_=None, **kwargs)[source]

Get the query params.

Parameters
  • type – Optional type or str (classname) that defines the request content type.

  • kwargs – Additional named arguments.

  • type_ (Optional[Union[type, str]]) –

Returns

A dictionary instance.

Return type

Any

abstract property has_query_params: bool

Check if the request has query params.

Returns

True if it has query params or False otherwise.

async content(**kwargs)

Get the request content.

Parameters

kwargs – Additional named arguments.

Returns

The request content.

Return type

Any

abstract property has_content: bool

Check if the request has content.

Returns

True if it has content or False otherwise.

abstract property has_params: bool

Check if the request has params.

Returns

True if it has params or False otherwise.

async params(**kwargs)

Get the request params.

Parameters

kwargs – Additional named arguments.

Returns

The request params.

Return type

dict[str, Any]

class HttpResponse[source]

Bases: Response, ABC

Http Response class.

__init__(*args, content_type='application/json', **kwargs)[source]
Parameters

content_type (str) –

property content_type: str

Get the content type.

Returns

A str value.

classmethod from_response(response)[source]

Build a new RestRequest from another response.

Parameters

response (Optional[Response]) – The base response.

Returns

A RestResponse instance.

Return type

HttpResponse

async content(**kwargs)

Response content.

Parameters

kwargs – Additional named arguments.

Returns

A list of items.

Return type

Any

property has_content: bool

Check if the request has content.

Returns

True if it has content or False otherwise.

property status: int

The status code of the response.

Returns

An int value.

exception HttpResponseException[source]

Bases: ResponseException

Http Response Exception class.

__init__(*args, status=400)
Parameters

status (int) –

__new__(**kwargs)
args
property status: int

The status code of the response.

Returns

An int value.

with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.