quantpylib.throttler.aiohttp
NetworkException
Bases: Exception
An exception class for network errors, capturing the status code, error message, function name, and class name.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
status_code |
str
|
The HTTP status code of the error. Defaults to an empty string. |
''
|
message |
str
|
The error message. Defaults to 'Network error occurred'. |
'Network error occurred'
|
Attributes:
Name | Type | Description |
---|---|---|
status_code |
str
|
The HTTP status code of the error. |
message |
str
|
The error message. |
function_name |
str
|
The name of the function where the error occurred. |
class_name |
str
|
The name of the class where the error occurred. |
descriptive_message |
str
|
The complete error message including function and class name. |
asession_requests_get(urls, asemaphore=None, costs=None, refunds_in=None)
async
Perform asynchronous HTTP GET requests.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
urls |
list
|
A list of URLs to request. |
required |
asemaphore |
AsyncRateSemaphore
|
An asynchronous semaphore to limit concurrent requests. Defaults to None. |
None
|
costs |
list
|
A list of costs for each request in terms of semaphore credits. Defaults to None. |
None
|
refunds_in |
list
|
A list of refund times for each request. Defaults to None. |
None
|
Returns:
Name | Type | Description |
---|---|---|
list |
A list of responses, with exceptions if any occurred. |
Raises:
Type | Description |
---|---|
NetworkException
|
If a request fails with a non-200 status code. |
asession_requests_post(urls, payloads, asemaphore=None, costs=None, refunds_in=None)
async
Perform asynchronous HTTP POST requests.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
urls |
list
|
A list of URLs to request. |
required |
payloads |
list
|
A list of payloads to send in the POST requests. |
required |
asemaphore |
AsyncRateSemaphore
|
An asynchronous semaphore to limit concurrent requests. Defaults to None. |
None
|
costs |
list
|
A list of costs for each request in terms of semaphore credits. Defaults to None. |
None
|
refunds_in |
list
|
A list of refund times for each request. Defaults to None. |
None
|
Returns:
Name | Type | Description |
---|---|---|
list |
A list of responses, with exceptions if any occurred. |
Raises:
Type | Description |
---|---|
NetworkException
|
If a request fails with a non-200 status code. |