SlyAPI.web#

Functions

serve_once(host, port, html_file)

Classes

Method(value[, names, module, qualname, ...])

Request(method, url, query_params, ...)

Exceptions

ApiError(status, reason, response)

exception SlyAPI.web.ApiError(status, reason, response)[source]#

Bases: Exception

Parameters:
  • status (int) –

  • reason (str | None) –

  • response (ClientResponse | None) –

status: int#
reason: str | None#
response: ClientResponse | None#
classmethod await from_resposnse(response)[source]#
Parameters:

response (ClientResponse) –

Return type:

ApiError

class SlyAPI.web.Method(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]#

Bases: Enum

GET = 'GET'#
POST = 'POST'#
PUT = 'PUT'#
DELETE = 'DELETE'#
PATCH = 'PATCH'#
class SlyAPI.web.Request(method: SlyAPI.web.Method, url: str, query_params: dict[str, str | int] = <factory>, headers: dict[str, str] = <factory>, data: dict[str, int | float | bool | str | None | list['JsonType'] | dict[str, 'JsonType']] | aiohttp.formdata.FormData = <factory>, data_is_json: bool = False)[source]#

Bases: object

Parameters:
method: Method#
url: str#
query_params: dict[str, str | int]#
headers: dict[str, str]#
data: dict[str, int | float | bool | str | None | list[int | float | bool | str | None | list[ForwardRef('JsonType')] | dict[str, ForwardRef('JsonType')]] | dict[str, int | float | bool | str | None | list[ForwardRef('JsonType')] | dict[str, ForwardRef('JsonType')]]] | ~aiohttp.formdata.FormData#
data_is_json: bool = False#
send(client)[source]#
Parameters:

client (ClientSession) –

await SlyAPI.web.serve_once(host, port, html_file)[source]#
Parameters:
  • host (str) –

  • port (int) –

  • html_file (str) –

Return type:

dict[str, str]