Skip to content

Commit

Permalink
add a MethodNotAllowedError. bump to version 0.2.2
Browse files Browse the repository at this point in the history
  • Loading branch information
benoitguigal committed Mar 28, 2017
1 parent 6921a85 commit a3382b8
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion figure/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@


__version__ = "0.2.1"
__version__ = "0.2.2"

token = None
api_base = 'https://api.figure.co'
Expand Down
5 changes: 4 additions & 1 deletion figure/api_requestor.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ def _handle_api_error(self, rbody, rcode):
if rcode == 404:
raise error.NotFoundError(status=rcode, body=rbody)

if rcode == 405:
raise error.MethodNotAllowedError(status=rcode, body=rbody)

if rcode == 429:
raise error.RateLimitError(status=rcode, body=rbody)

Expand All @@ -73,7 +76,7 @@ def _handle_api_error(self, rbody, rcode):
if rcode == 503:
raise error.APIConnectionError(status=rcode, body=rbody)

raise error.FigureError(mesage="Something went wrong", status=rcode)
raise error.FigureError(message="Something went wrong", status=rcode)

def _interpret_response(self, rbody, rcode):
if not (200 <= rcode < 300):
Expand Down
8 changes: 8 additions & 0 deletions figure/error.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,14 @@ def __init__(self, message=None, status=None, body=None):
self.type = 'rate_limit_error'


class MethodNotAllowedError(FigureError):

def __init__(self, message=None, status=None, body=None):
message = message or u'Method not allowed'
super(MethodNotAllowedError, self).__init__(message, status, body)
self.type = 'method_not_allowed_error'


class InternalServerError(FigureError):

def __init__(self, message=None, status=None, body=None):
Expand Down

0 comments on commit a3382b8

Please sign in to comment.