Commit 748d1a00 authored by J. Fernando Sánchez's avatar J. Fernando Sánchez
Browse files

Fix bug in POST

parent a82e4ed4
...@@ -69,7 +69,7 @@ def encoded_url(url=None, base=None): ...@@ -69,7 +69,7 @@ def encoded_url(url=None, base=None):
if request.method == 'GET': if request.method == 'GET':
url = request.full_path[1:] # Remove the first slash url = request.full_path[1:] # Remove the first slash
else: else:
hash(frozenset(request.parameters.items())) hash(frozenset(tuple(request.parameters.items())))
code = 'hash:{}'.format(hash) code = 'hash:{}'.format(hash)
code = code or base64.urlsafe_b64encode(url.encode()).decode() code = code or base64.urlsafe_b64encode(url.encode()).decode()
......
...@@ -25,7 +25,11 @@ class Client(object): ...@@ -25,7 +25,11 @@ class Client(object):
def request(self, path=None, method='GET', **params): def request(self, path=None, method='GET', **params):
url = '{}{}'.format(self.endpoint.rstrip('/'), path) url = '{}{}'.format(self.endpoint.rstrip('/'), path)
response = requests.request(method=method, url=url, params=params) if method == 'POST':
response = requests.post(url=url, data=params)
else:
response = requests.request(method=method, url=url, params=params)
try: try:
resp = models.from_dict(response.json()) resp = models.from_dict(response.json())
except Exception as ex: except Exception as ex:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment