Browse Source

(fix) request prepare: data can be not dict

(feat) request prepare: if data contains id it must be int
master
Alexeev Nickolay 5 years ago
parent
commit
69947e29fe
  1. 5
      yandex_connect/base.py

5
yandex_connect/base.py

@ -120,11 +120,14 @@ class YandexConnectRequest(object):
if not url.endswith('/'):
url = '%s/' % url
if data:
if data and isinstance(data, dict):
for key in list(data):
if data[key] is None or (isinstance(data[key], dict) and not data[key]):
del data[key]
continue
if 'id' in data and type(data['id']) is not int:
data['id'] = int(data['id'])
method = method.lower()
if method not in ['get', 'post', 'patch', 'delete']:
raise ValueError('Not right method')

Loading…
Cancel
Save