mirror of
https://github.com/gsi-upm/senpy
synced 2024-12-22 04:58:12 +00:00
Fix bug in POST
This commit is contained in:
parent
a82e4ed440
commit
748d1a00bd
@ -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()
|
||||
|
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user