homematicip.connection.buckets¶
homematicip.connection.buckets
¶
Buckets
¶
Class to manage the rate limiting of the HomematicIP Cloud API. The implementation is based on the token bucket algorithm.
__init__
¶
take
async
¶
wait_and_take
async
¶
Wait until a token is available and then take it. Return True if successful, False otherwise.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
int
|
The maximum time to wait for a token in seconds. Default is 120 seconds. |
120
|
|
int
|
The number of tokens to take from the bucket. Default is 1. |
1
|
Returns:
| Type | Description |
|---|---|
bool
|
True if successful, False otherwise. |