mirror of
https://github.com/gsi-upm/senpy
synced 2024-11-25 01:22:28 +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':
|
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):
|
|||||||
|
|
||||||
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:
|
||||||
|
Loading…
Reference in New Issue
Block a user