themiurgo / ratelim Goto Github PK
View Code? Open in Web Editor NEWMakes it easy to respect rate limits.
License: MIT License
Makes it easy to respect rate limits.
License: MIT License
This might allow to keep rate limits upon subsequent calls.
Docstrings and other attributes are not preserved when using the decorators in this package. For example:
>>> import ratelim
>>> def f():
... """Docs"""
...
>>> f.__doc__
'Docs'
>>> f = ratelim.greedy(10, 5)(f)
>>> f
<function wrapped_f at 0x10dd041b8>
>>> f.__doc__
>>>
Other attributes that should be preserved are __name__
and __module__
. In particular this is important as a decorator should aim to decorate the existing function and therefore preserve its details.
Tests are needed.
Someone mentioned to me that your PyPi package doesn't contain a Zip file in your latest release.
He was running a linux OS and couldn't install it from the setup.py file.
When uploading wheel also include sdist
for the zip fie.
$ python setup.py sdist bdist_wheel upload
Introduce the possibility to have wait-times chosen from arbitrary distributions (e.g., gaussian, poissonian, ...), but which still respect the rate limit.
Right now ratelim.patient distributes evenly function calls.
When a function call runs for longer than the wait time, the ratelimiter could make up for that lost time by sleeping for shorter intervals in next function calls. This is not currently implemented.
I'm getting this indentation errors when I'm testing it in a Python 3.4 env.
I think it's only the latest version of PyPi, your github repo looks good.
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/ubuntu/Github/geocoder/geocoder/__init__.py", line 35, in <module>
from .api import get, yahoo, bing, geonames, google, mapquest
File "/home/ubuntu/Github/geocoder/geocoder/api.py", line 10, in <module>
from .google import Google
File "/home/ubuntu/Github/geocoder/geocoder/google.py", line 4, in <module>
import ratelim
File "/home/ubuntu/env/lib/python3.4/site-packages/ratelim/__init__.py", line 18
self.__max_calls = max_calls
^
TabError: inconsistent use of tabs and spaces in indentation
Seems some git marks appears on init.py:
94baa8b... Remove external function for providing totalseconds to timedelta objects and make it inline using exceptions
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.