This module contains the throttlers.
Exception that occurs when something goes wrong while changing status
| Parameters: |
|
|---|
Exception that occurs when an enqueue is tried in a full pool
| Parameters: |
|
|---|
This class provides the base requests throttler
The base throttler guarantees that between each request a fixed amount of time between them elapsed. The pool can be limited by a maximum length and an exception is raised if a request is tried to be enqueued in the full pool.
| Parameters: |
|
|---|
Create a base throttler with the given delay time and pool size
When both delay and reqs_over_time are None, delay is set to 0.
| Parameters: |
|
||
|---|---|---|---|
| Raise: |
|
The status of the throttler
| Getter: | Returns status |
||||
|---|---|---|---|---|---|
| Setter: | Sets the new status |
||||
| Raise: |
|
||||
| Type: | string |
||||
Start the throttler by starting the main loop
| Raise: |
|
||||
|---|---|---|---|---|---|
Shutdown the throttler by shutdowning the executor
If wait_enqueued is True then before stopping the throttlers consumes all the requests enqueued. Otherwise the throttler is forced to be shutdowned.
| Parameters: | wait_enqueued – the flag that indicates if the already enqueued requests are to be processed or aborted |
||||
|---|---|---|---|---|---|
| Raise: |
|
||||
Pause the throttler
| Raise: |
|
||||
|---|---|---|---|---|---|
Unpause the throttler
| Raise: |
|
||||
|---|---|---|---|---|---|
Submit a single request and return the corresponding throttled request
| Parameters: | req (requests.Request) – the request to throttle |
||||
|---|---|---|---|---|---|
| Returns: | the corresponding throttled request |
||||
| Return type: | |||||
| Raise: |
|
||||
Submits a list of requests and return the corresponding list of throttled requests
| Parameters: | reqs – the list of requests to throttle |
||||
|---|---|---|---|---|---|
| Returns: | the corresponding list of throttled requests |
||||
| Return type: | |||||
| Raise: |
|
||||
Wait until the throttler is ended