-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rate limiting added to core client (#315)
* Rate limiting added to core client * Ratelimit added to reqs
- Loading branch information
Jason Munro
authored
Jul 4, 2021
1 parent
8f9c178
commit 1a895a6
Showing
5 changed files
with
23 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,3 +5,4 @@ maggma==0.29.4 | |
requests==2.25.1 | ||
monty==2021.6.10 | ||
emmet-core==0.4.1 | ||
ratelimit==2.2.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,6 +31,7 @@ | |
"monty", | ||
"emmet-core", | ||
"maggma", | ||
"ratelimit", | ||
], | ||
extras_require={ | ||
"server": [ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
from ratelimit import sleep_and_retry, limits | ||
from mp_api.core.settings import MAPISettings | ||
|
||
|
||
@sleep_and_retry | ||
@limits(calls=MAPISettings().requests_per_min, period=60) | ||
def check_limit(): | ||
""" | ||
Empty function for enabling global rate limiting. | ||
""" | ||
return |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters