api_client module
Makes API requests to D2S API.
Source code in d2spy/api_client.py
__init__(base_url, session)
¶
Constructor for APIClient class.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
base_url
|
str
|
Base URL for D2S instance. |
required |
session
|
Session
|
Session set by Auth. |
required |
Raises:
Type | Description |
---|---|
ValueError
|
Raised if access token missing from session. |
Source code in d2spy/api_client.py
make_get_request(endpoint, **kwargs)
¶
Makes GET request to D2S API.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
endpoint
|
str
|
D2S endpoint for request. |
required |
Returns:
Type | Description |
---|---|
Union[Dict[Any, Any], List[Dict[Any, Any]]]
|
Union[Dict, List]: JSON response from request. |
Source code in d2spy/api_client.py
make_post_request(endpoint, **kwargs)
¶
Make POST request to D2S API.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
endpoint
|
str
|
D2S endpoint for request. |
required |
Returns:
Name | Type | Description |
---|---|---|
Dict |
Dict[Any, Any]
|
JSON response from request. |
Source code in d2spy/api_client.py
make_put_request(endpoint, **kwargs)
¶
Make PUT request to D2S API.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
endpoint
|
str
|
D2S endpoint for request. |
required |
Returns:
Name | Type | Description |
---|---|---|
Dict |
Dict[Any, Any]
|
JSON response from request. |