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
a1e4d8b6
Unverified
Commit
a1e4d8b6
authored
Nov 06, 2016
by
Aaron Hill
Browse files
Properly wrap errors from Requests
parent
17f73ed2
Changes
1
Hide whitespace changes
Inline
Side-by-side
tweepy/binder.py
View file @
a1e4d8b6
...
@@ -15,6 +15,8 @@ import logging
...
@@ -15,6 +15,8 @@ import logging
from
tweepy.error
import
TweepError
,
RateLimitError
,
is_rate_limit_error_message
from
tweepy.error
import
TweepError
,
RateLimitError
,
is_rate_limit_error_message
from
tweepy.utils
import
convert_to_utf8_str
from
tweepy.utils
import
convert_to_utf8_str
from
tweepy.models
import
Model
from
tweepy.models
import
Model
import
six
import
sys
re_path_template
=
re
.
compile
(
'{\w+}'
)
re_path_template
=
re
.
compile
(
'{\w+}'
)
...
@@ -170,6 +172,7 @@ def bind_api(**config):
...
@@ -170,6 +172,7 @@ def bind_api(**config):
# time.sleep(sleep_time + 5) # sleep for few extra sec
# time.sleep(sleep_time + 5) # sleep for few extra sec
# Apply authentication
# Apply authentication
auth
=
None
if
self
.
api
.
auth
:
if
self
.
api
.
auth
:
auth
=
self
.
api
.
auth
.
apply_auth
()
auth
=
self
.
api
.
auth
.
apply_auth
()
...
@@ -186,8 +189,10 @@ def bind_api(**config):
...
@@ -186,8 +189,10 @@ def bind_api(**config):
auth
=
auth
,
auth
=
auth
,
proxies
=
self
.
api
.
proxy
)
proxies
=
self
.
api
.
proxy
)
except
Exception
as
e
:
except
Exception
as
e
:
raise
TweepError
(
'Failed to send request: %s'
%
e
)
six
.
reraise
(
TweepError
,
TweepError
(
'Failed to send request: %s'
%
e
),
sys
.
exc_info
()[
2
])
rem_calls
=
resp
.
headers
.
get
(
'x-rate-limit-remaining'
)
rem_calls
=
resp
.
headers
.
get
(
'x-rate-limit-remaining'
)
if
rem_calls
is
not
None
:
if
rem_calls
is
not
None
:
self
.
_remaining_calls
=
int
(
rem_calls
)
self
.
_remaining_calls
=
int
(
rem_calls
)
elif
isinstance
(
self
.
_remaining_calls
,
int
):
elif
isinstance
(
self
.
_remaining_calls
,
int
):
...
...
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