From 3713b093b685b36e64831c2033b374de8d5b3a80 Mon Sep 17 00:00:00 2001 From: Ihor Polyakov Date: Thu, 22 Jun 2017 10:35:13 +0700 Subject: [PATCH] json.dumps(allowed_updates) before sending request --- telebot/apihelper.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/telebot/apihelper.py b/telebot/apihelper.py index b5372cd..9276a92 100644 --- a/telebot/apihelper.py +++ b/telebot/apihelper.py @@ -1,5 +1,10 @@ # -*- coding: utf-8 -*- +try: + import ujson as json +except ImportError: + import json + import requests try: @@ -137,7 +142,7 @@ def set_webhook(token, url=None, certificate=None, max_connections=None, allowed if max_connections: payload['max_connections'] = max_connections if allowed_updates: - payload['allowed_updates'] = allowed_updates + payload['allowed_updates'] = json.dumps(allowed_updates) return _make_request(token, method_url, params=payload, files=files) @@ -162,7 +167,7 @@ def get_updates(token, offset=None, limit=None, timeout=None, allowed_updates=No if timeout: payload['timeout'] = timeout if allowed_updates: - payload['allowed_updates'] = allowed_updates + payload['allowed_updates'] = json.dumps(allowed_updates) return _make_request(token, method_url, params=payload)