39
39
API_PATH_V2 = '/ox/4.0'
40
40
API_PATH_SSO = '/api'
41
41
ACCEPTABLE_PATHS = (API_PATH_V1 , API_PATH_V2 , API_PATH_SSO )
42
- JSON_PATHS = (API_PATH_V2 )
42
+ JSON_PATHS = (API_PATH_V2 , )
43
43
HTTP_METHOD_OVERRIDES = ['DELETE' , 'PUT' , 'OPTIONS' ]
44
44
45
45
@@ -60,7 +60,7 @@ class Client(object):
60
60
of Python dictionaries, translated to and from the JSON and
61
61
query string encoding the API itself uses.
62
62
63
- """
63
+ """
64
64
65
65
66
66
def __init__ (self , domain , realm , consumer_key , consumer_secret ,
@@ -92,7 +92,7 @@ def __init__(self, domain, realm, consumer_key, consumer_secret,
92
92
headers -- list of headers to send with the request
93
93
timeout -- http request timeout in seconds.
94
94
"""
95
-
95
+
96
96
self .domain = domain
97
97
self .consumer_key = consumer_key
98
98
self .consumer_secret = consumer_secret
@@ -103,7 +103,7 @@ def __init__(self, domain, realm, consumer_key, consumer_secret,
103
103
self .authorization_url = authorization_url
104
104
self .api_path = api_path
105
105
self .timeout = timeout
106
-
106
+
107
107
# Validate API path:
108
108
if api_path not in ACCEPTABLE_PATHS :
109
109
msg = '"{}" is not a recognized API path.' .format (api_path )
@@ -339,13 +339,13 @@ def get(self, url):
339
339
return response .json ()
340
340
except :
341
341
return response .content
342
-
342
+
343
343
def options (self , url ):
344
344
"""Send a request with HTTP method OPTIONS to the given
345
345
URL or API shorthand.
346
-
346
+
347
347
OX3 v2 uses this method for showing help information.
348
-
348
+
349
349
"""
350
350
response = self ._session .options (self ._resolve_url (url ), timeout = self .timeout )
351
351
self .log_request (response )
@@ -389,7 +389,7 @@ def post(self, url, data=None):
389
389
390
390
def delete (self , url ):
391
391
"""Issue a DELETE request to the URL or API shorthand."""
392
- response = requests .delete (self ._resolve_url (url ))
392
+ response = self . _session .delete (self ._resolve_url (url ))
393
393
self .log_request (response )
394
394
response .raise_for_status ()
395
395
# Catch no content responses from some delete actions.
0 commit comments