repology_client.utils#
Utility functions and classes.
- repology_client.utils.get_type_adapter(t: type[T]) TypeAdapter#
Get a cached
TypeAdapterinstance.- Parameters:
t – type
- class repology_client.utils.limit(calls: int, period: float)#
Bases:
objectDecorator to set a limit on requests per second.
Based on this StackOverflow answer.
- repology_client.utils.ensure_session(session: ClientSession | None = None) AsyncGenerator[ClientSession, None]#
Create a new client session, if necessary, and close it on exit.
- Parameters:
session –
aiohttpclient session
- repology_client.utils.format_link_status(code: int) str#
Convert status codes to human-readable messages.
See also
repology_client.get_problems()functionImplements
/api/v1/repository/<repo>/problemsand/api/v1/maintainer/<maint>/problems-for-repo/<repo>endpoints.
>>> format_link_status(404) 'HTTP 404' >>> format_link_status(-100) 'connect timeout (60 seconds)' >>> format_link_status(-999) 'unknown status code -999, please report a bug to repology-client'