Represents interactions with hypertexted resources in the API.
This class is effectively a client within a client, so it can access any API endpoint if the base URI and authentication pair are defined appropriately.
Derived from Resource.
Returns a representation of the REST resource.
Its functionality is derived from Resource.get().
Parameters: |
|
---|---|
Returns: | Resource representation. |
Return type: | EasyDict object. |
Retrieves header data of the REST resource.
Its functionality is derived from Resource.head().
Parameters: | uri (string) – URI of REST resource, relative to base URI. |
---|---|
Returns: | Header data. |
Return type: | EasyDict object. |
Retrieves documentation of the REST resource representation.
Its functionality is derived from Resource.options().
Parameters: | uri (string) – URI of REST resource, relative to base URI. |
---|---|
Returns: | Resource documentation data. |
Return type: | EasyDict object. |
Represents interactions with a REST API resource.
Sets the high-level (versioning) endpoint for the API resource.
Parameters: |
|
---|
Retrieves a representation of the REST resource.
If the request is successful, returns an EasyDict object that uses dot notation for the response contents.
A request may be unsuccessful for two reasons:
- The API returns an error (HTTP code not 200). In this situation, the client raises a SoccermetricsRestException with the HTTP code, the request URI, and a detailed error message.
- The requests module raises an exception. In this case, the client raises a SoccermetricsRestException with HTTP code 500, the request URI and a detailed error message from the module.
Parameters: |
|
---|---|
Returns: | Resource representation. |
Return type: | EasyDict object. |
Retrieves header data of the REST resource.
The response is an object with the following attribute:
Attribute | Description |
---|---|
headers | Response headers |
If the request is successful, the client returns an EasyDict object that uses dot notation for the response contents.
If the request is unsuccessful (HTTP code 4xx or 5xx), the client raises a SoccermetricsRestException that includes the HTTP status code and the request URI.
Returns: | Header data. |
---|---|
Return type: | EasyDict object. |
Retrieves documentation of the REST resource representation.
If the status code is 200 (OK), returns the documentation. Otherwise, returns an error.
The response is an object with the following attributes:
Attribute | Description |
---|---|
headers | Response headers |
data | Resource documentation |
Link resources are not included in the documentation.
Returns: | Resource documentation data. |
---|---|
Return type: | EasyDict object. |
Represents a REST API response object and its pagination properties and methods.
The response is an object with the following attributes:
Attribute | Description |
---|---|
status | Response status code |
headers | Response headers |
_meta | Response meta-data, internal use only |
data | Response data |
The response also contains the following properties:
Property | Description |
---|---|
page | Current page of response |
pages | Total pages of response |
records_page | Number of records per page |
records | Total records in response |
You can use the following methods to page through the response:
Method | Description |
---|---|
first() | First page of API response |
prev() | Previous page of API response |
next() | Next page of API response |
last() | Last page of API response |
If you wish to access all of the data at once, there is the all() method.
Derived from Resource.
Go to first page of the API response.
If meta-data does not exist (i.e. no GET data), return None.
Go to last page of the API response.
If meta-data does not exist (i.e. no GET data), return None.
Go to next page of the API response.
If meta-data does not exist (i.e. no GET data), return None.
Current page of API response given pagination settings.
If meta-data does not exist (i.e. no GET data), the current page is zero.
Total pages in API response given pagination settings.
If meta-data does not exist (i.e. no GET data), the total number of pages is zero.
Go to previous page of the API response.
If meta-data does not exist (i.e. no GET data), return None.