Response¶
When calling one of the Sports Classes methods, you get an
AbstractResponse object as result.
Usually you only need the ok property to check if the request succeeded, and
the errors and error_description property if there was an error.
If the request succeeded, you can iterate directly over the
AbstractResponse object.
In effect, the iteration is delegated to a
AbstractData object, which you can also
access directly by calling the data property.
-
class
apisports.response.AbstractResponse(client, response, data=None)[source]¶ Bases:
objectGeneric response object.
- Parameters
-
__iter__()[source]¶ Delegates iteration to the
AbstractDataclass.
-
__len__()[source]¶ Delegates
len()to theAbstractDataclass.
-
static
create(client, response)[source]¶ AbstractResponse factory method.
- Parameters
client (apisports._client.Client) –
Clientobjectresponse (requests.Response) –
Responseobject
- Returns
AbstractResponseobject- Return type
-
property
data¶ Get the
AbstractDataobject.- Returns
AbstractDataobject- Return type
-
property
error_description¶ Get a string representation of the errors, or “Success” on success…
- Returns
Error string
- Return type
-
property
raw¶ Get raw Response object.
- Returns
Responseobject.- Return type
requests.Response
-
class
apisports.response.Headers(headers)[source]¶ Bases:
objectResponse Headers details class.
- Parameters
headers (requests.structures.CaseInsensitiveDict) –
CaseInsensitiveDictobject
-
property
rate_limit_remaining¶ Number of API calls remaining before reaching the limit per minute.
- Return type
-
property
raw¶ Get raw headers.
- Returns
CaseInsensitiveDictobject- Return type
CaseInsensitiveDict
-
property
requests_limit¶ The number of requests allocated per day according to your subscription
- Return type
-
property
requests_remaining¶ The number of remaining requests per day according to your subscription.
- Return type
-
class
apisports.response.HttpErrorResponse(client, response, data=None)[source]¶ Bases:
apisports.response.ErrorResponse-
property
error_description¶ Get a string representation of the errors, or “Success” on success…
- Returns
Error string
- Return type
-
property
-
class
apisports.response.SuccessResponse(client, response, data=None)[source]¶ Bases:
apisports.response.AbstractResponse-
property
data¶ Get the
AbstractDataobject.- Returns
AbstractDataobject- Return type
-
property