Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Zahra Rajabi
tweepy
Commits
b768e76c
Commit
b768e76c
authored
Oct 13, 2009
by
Josh Roesslein
Browse files
Allow defining retry count and delay defaults on API object.
Example: api.retry_count = 5 --> retry failed requests 5 times maxium
parent
8fd79bab
Changes
2
Hide whitespace changes
Inline
Side-by-side
tweepy/api.py
View file @
b768e76c
...
...
@@ -15,7 +15,8 @@ class API(object):
"""Twitter API"""
def
__init__
(
self
,
auth_handler
=
None
,
host
=
'twitter.com'
,
cache
=
None
,
secure
=
False
,
api_root
=
''
,
validate
=
True
):
secure
=
False
,
api_root
=
''
,
validate
=
True
,
retry_count
=
0
,
retry_delay
=
0
):
# you may access these freely
self
.
auth_handler
=
auth_handler
self
.
host
=
host
...
...
@@ -23,6 +24,8 @@ class API(object):
self
.
cache
=
cache
self
.
secure
=
secure
self
.
validate
=
validate
self
.
retry_count
=
retry_count
self
.
retry_delay
=
retry_delay
# not a good idea to touch these
self
.
_username
=
None
...
...
tweepy/binder.py
View file @
b768e76c
...
...
@@ -33,8 +33,8 @@ def bind_api(path, parser, allowed_param=[], method='GET', require_auth=False,
post_data
=
kargs
.
pop
(
'post_data'
,
None
)
# check for retry request parameters
retry_count
=
kargs
.
pop
(
'retry_count'
,
0
)
retry_delay
=
kargs
.
pop
(
'retry_delay'
,
0
)
retry_count
=
kargs
.
pop
(
'retry_count'
,
api
.
retry_count
)
retry_delay
=
kargs
.
pop
(
'retry_delay'
,
api
.
retry_delay
)
# check for headers
headers
=
kargs
.
pop
(
'headers'
,
{})
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment