Skip to content

Commit

Permalink
Remove API.wait_on_rate_limit_notify
Browse files Browse the repository at this point in the history
  • Loading branch information
Harmon758 committed Feb 2, 2021
1 parent 3ba756b commit f325738
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 12 deletions.
6 changes: 1 addition & 5 deletions docs/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ This page contains some basic documentation for the Tweepy module.
.. class:: API([auth_handler=None], [host='api.twitter.com'], [cache=None], \
[api_root='/1'], , [retry_count=0], [retry_delay=0], \
[retry_errors=None], [timeout=60], [parser=ModelParser], \
[compression=False], [wait_on_rate_limit=False], \
[wait_on_rate_limit_notify=False], [proxy=None])
[compression=False], [wait_on_rate_limit=False], [proxy=None])

This class provides a wrapper for the API as provided by Twitter.
The functions provided in this class are listed below.
Expand All @@ -33,9 +32,6 @@ This page contains some basic documentation for the Tweepy module.
:param compression: Whether or not to use GZIP compression for requests
:param wait_on_rate_limit: Whether or not to automatically wait for rate
limits to replenish
:param wait_on_rate_limit_notify: Whether or not to print a notification
when Tweepy is waiting for rate limits to
replenish
:param proxy: The full url to an HTTPS proxy to use for connecting to
Twitter.

Expand Down
6 changes: 1 addition & 5 deletions tweepy/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ def __init__(self, auth_handler=None,
host='api.twitter.com', upload_host='upload.twitter.com',
cache=None, api_root='/1.1', upload_root='/1.1',
retry_count=0, retry_delay=0, retry_errors=None, timeout=60,
parser=None, wait_on_rate_limit=False,
wait_on_rate_limit_notify=False, proxy=''):
parser=None, wait_on_rate_limit=False, proxy=''):
"""
API instance constructor
Expand All @@ -41,8 +40,6 @@ def __init__(self, auth_handler=None,
default: None
:param wait_on_rate_limit: If the api wait when it hits the rate limit,
default: False
:param wait_on_rate_limit_notify: If the api print a notification when
the rate limit is hit, default: False
:param proxy: Url to use as proxy during the HTTP request, default: ''
:raise TypeError: If the given parser is not a ModelParser instance.
Expand All @@ -58,7 +55,6 @@ def __init__(self, auth_handler=None,
self.retry_errors = retry_errors
self.timeout = timeout
self.wait_on_rate_limit = wait_on_rate_limit
self.wait_on_rate_limit_notify = wait_on_rate_limit_notify
self.parser = parser or ModelParser()
self.proxy = {}
if proxy:
Expand Down
3 changes: 1 addition & 2 deletions tweepy/binder.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,7 @@ def execute(api, method, path, *args, allowed_param=[], params=None,
# Handle running out of API calls
sleep_time = reset_time - int(time.time())
if sleep_time > 0:
if api.wait_on_rate_limit_notify:
log.warning(f"Rate limit reached. Sleeping for: {sleep_time}")
log.warning(f"Rate limit reached. Sleeping for: {sleep_time}")
time.sleep(sleep_time + 1) # Sleep for extra sec

# Apply authentication
Expand Down

0 comments on commit f325738

Please sign in to comment.