aiobtclientapi.response
API Response
Classes
- class aiobtclientapi.response.Response(*, success, warnings=(), errors=(), tasks=(), **kwargs)[source]
Bases:
SimpleNamespaceResponse to API call
API methods of
APIBasesubclasses return an instance of this class.- Parameters:
Any other keyword arguments are made available as attributes. Custom reponse attributes should be documented by the relevant API methods.
- property as_dict
Provide attributes as dictionary
- async classmethod from_call(call, attributes=None, types=None, exception=None)[source]
Create
Responseinstance from asynchronous call- Parameters:
call –
Coroutine or asynchronous generator
call may
return,yieldorraise:(attribute, value)attributemust be a valid attribute name andvalueis assigned/appended to that attribute.ErrorinstanceErrors are appended to the
errorsattribute.successis set to False.WarninginstanceWarnings are appended to the
warningsattribute.successis kept as it is.TaskBackground tasks initiated by call are appended to
tasksso they can be awaited if needed.NotImplementedErrorinstanceIndicates an unimplemented feature. The exception is wrapped in
NotImplementedErrorand appended toerrors.BaseExceptioninstanceAll exceptions not documented above are re-raised.
attributes –
Mapping of custom attributes to default values
If the default value is a
list, values from call for that attribute are appended to that list instead of replacing it.types –
Mapping of custom attributes to classes
If an attribute’s value is not an instance of its class, it is instantiated as its class.
For sequence attributes, each item is handled as described above.
Attributes that don’t have a type are taken as they are.
exception – Exception class that wraps every item in
errorsor None