MCPcopy Index your code
hub / github.com/ryanmcgrath/twython / TwythonError

Class TwythonError

twython/exceptions.py:13–33  ·  view source on GitHub ↗

Generic error class, catch-all for most Twython issues. Special cases are handled by TwythonAuthError & TwythonRateLimitError. from twython import TwythonError, TwythonRateLimitError, TwythonAuthError

Source from the content-addressed store, hash-verified

11
12
13class TwythonError(Exception):
14 """Generic error class, catch-all for most Twython issues.
15 Special cases are handled by TwythonAuthError & TwythonRateLimitError.
16
17 from twython import TwythonError, TwythonRateLimitError, TwythonAuthError
18
19 """
20 def __init__(self, msg, error_code=None, retry_after=None):
21 self.error_code = error_code
22
23 if error_code is not None and error_code in TWITTER_HTTP_STATUS_CODE:
24 msg = 'Twitter API returned a %s (%s), %s' % \
25 (error_code,
26 TWITTER_HTTP_STATUS_CODE[error_code][0],
27 msg)
28
29 super(TwythonError, self).__init__(msg)
30
31 @property
32 def msg(self): # pragma: no cover
33 return self.args[0]
34
35
36class TwythonAuthError(TwythonError):

Callers 7

_requestMethod · 0.85
requestMethod · 0.85
get_authorized_tokensMethod · 0.85
obtain_access_tokenMethod · 0.85
cursorMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected