Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

if the HTTP response is 401 throw an Unauthorized exception. This hel…

…ps to distinguish authorization problems from other problems (i.e. requesting nonexisting boards, lists etc.)
  • Loading branch information...
commit 41735cf698dd69404172c54d48dd2b4713c1dbfd 1 parent 864a95b
@dirk-olmes dirk-olmes authored
Showing with 5 additions and 0 deletions.
  1. +5 −0 trello/__init__.py
View
5 trello/__init__.py
@@ -19,6 +19,9 @@ def __init__(self, msg):
def __str__(self):
return "Resource unavailable: %s" % (self._msg)
+class Unauthorized(ResourceUnavailable):
+ pass
+
class TrelloClient(object):
""" Base class for Trello API access """
@@ -127,6 +130,8 @@ def fetch_json(
body = json.dumps(post_args))
# error checking
+ if response.status == 401:
+ raise Unauthorized(url)
if response.status != 200:
raise ResourceUnavailable(url)
return json.loads(content)
Please sign in to comment.
Something went wrong with that request. Please try again.