From 748d1a00bde163c786fac60eed775321660cc0f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=2E=20Fernando=20S=C3=A1nchez?= Date: Tue, 30 Oct 2018 16:35:17 +0100 Subject: [PATCH] Fix bug in POST --- senpy/blueprints.py | 2 +- senpy/client.py | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/senpy/blueprints.py b/senpy/blueprints.py index 5122241..33598d7 100644 --- a/senpy/blueprints.py +++ b/senpy/blueprints.py @@ -69,7 +69,7 @@ def encoded_url(url=None, base=None): if request.method == 'GET': url = request.full_path[1:] # Remove the first slash else: - hash(frozenset(request.parameters.items())) + hash(frozenset(tuple(request.parameters.items()))) code = 'hash:{}'.format(hash) code = code or base64.urlsafe_b64encode(url.encode()).decode() diff --git a/senpy/client.py b/senpy/client.py index 43414f8..dfe0579 100644 --- a/senpy/client.py +++ b/senpy/client.py @@ -25,7 +25,11 @@ class Client(object): def request(self, path=None, method='GET', **params): 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: resp = models.from_dict(response.json()) except Exception as ex: