From 69947e29fea5c2e2b95ddbf7709d1828314b7140 Mon Sep 17 00:00:00 2001 From: Alexeev Nickolay Date: Tue, 5 Feb 2019 22:15:24 +0300 Subject: [PATCH] (fix) request prepare: data can be not dict (feat) request prepare: if data contains id it must be int --- yandex_connect/base.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/yandex_connect/base.py b/yandex_connect/base.py index 9b637ca..3d2f4d4 100644 --- a/yandex_connect/base.py +++ b/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')