SlyAPI.webapi#

Implementation for following classes:

  • WebAPI

Functions

Classes

WebAPI(auth[, use_form_data])

Base class for web APIs

SlyAPI.webapi.is_dataclass_instance(obj)[source]#
Parameters:

obj (object) –

Return type:

TypeIs[DataclassInstance]

class SlyAPI.webapi.WebAPI(auth, use_form_data=False)[source]#

Bases: object

Base class for web APIs

Parameters:
  • auth (Auth) –

  • use_form_data (bool) –

base_url: str#
auth: Auth#
get_full_url(path)[source]#

Convert a relative path to an absolute url for this API

Parameters:

path (str) –

Return type:

str

await delete_json(path, params=None, json=None, headers=None)[source]#
Parameters:
await get_json(path, params=None, json=None, headers=None)[source]#
Parameters:
Return type:

dict[str, int | float | bool | str | None | list[‘JsonType’] | dict[str, ‘JsonType’]]

await post_json(path, params=None, json=None, headers=None)[source]#
Parameters:
Return type:

dict[str, int | float | bool | str | None | list[‘JsonType’] | dict[str, ‘JsonType’]]

await post_json_empty(path, params=None, json=None, headers=None)[source]#
Parameters:
await put_json(path, params=None, json=None, headers=None)[source]#
Parameters:
Return type:

dict[str, int | float | bool | str | None | list[‘JsonType’] | dict[str, ‘JsonType’]]

await get_form(path, params=None, data=None, headers=None)[source]#
Parameters:
Return type:

dict[str, int | float | bool | str | None | list[‘JsonType’] | dict[str, ‘JsonType’]]

await post_form(path, params=None, data=None, headers=None)[source]#
Parameters:
Return type:

dict[str, int | float | bool | str | None | list[‘JsonType’] | dict[str, ‘JsonType’]]

await post_form_empty(path, params=None, data=None, headers=None)[source]#
Parameters:
await put_form(path, params=None, data=None, headers=None)[source]#
Parameters:
Return type:

dict[str, int | float | bool | str | None | list[‘JsonType’] | dict[str, ‘JsonType’]]

await get_text(path, params=None, json=None, headers=None)[source]#
Parameters:
Return type:

str

paginated(path, params, limit)[source]#

Return an awaitable and async iterable over google or twitter-style paginated items. You can also await the return value to get the entire list.

Parameters:
Return type:

AsyncLazy[dict[str, int | float | bool | str | None | list[‘JsonType’] | dict[str, ‘JsonType’]]]