Skip to content

Commit a3382b8

Browse files
committed
add a MethodNotAllowedError. bump to version 0.2.2
1 parent 6921a85 commit a3382b8

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

figure/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22

3-
__version__ = "0.2.1"
3+
__version__ = "0.2.2"
44

55
token = None
66
api_base = 'https://api.figure.co'

figure/api_requestor.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,9 @@ def _handle_api_error(self, rbody, rcode):
6161
if rcode == 404:
6262
raise error.NotFoundError(status=rcode, body=rbody)
6363

64+
if rcode == 405:
65+
raise error.MethodNotAllowedError(status=rcode, body=rbody)
66+
6467
if rcode == 429:
6568
raise error.RateLimitError(status=rcode, body=rbody)
6669

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

76-
raise error.FigureError(mesage="Something went wrong", status=rcode)
79+
raise error.FigureError(message="Something went wrong", status=rcode)
7780

7881
def _interpret_response(self, rbody, rcode):
7982
if not (200 <= rcode < 300):

figure/error.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,14 @@ def __init__(self, message=None, status=None, body=None):
6565
self.type = 'rate_limit_error'
6666

6767

68+
class MethodNotAllowedError(FigureError):
69+
70+
def __init__(self, message=None, status=None, body=None):
71+
message = message or u'Method not allowed'
72+
super(MethodNotAllowedError, self).__init__(message, status, body)
73+
self.type = 'method_not_allowed_error'
74+
75+
6876
class InternalServerError(FigureError):
6977

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

0 commit comments

Comments
 (0)