1
0
mirror of https://github.com/eternnoir/pyTelegramBotAPI.git synced 2023-08-10 21:12:57 +03:00

json.dumps(allowed_updates) before sending request

This commit is contained in:
Ihor Polyakov 2017-06-22 10:35:13 +07:00
parent e834903bc2
commit 3713b093b6

View File

@ -1,5 +1,10 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
try:
import ujson as json
except ImportError:
import json
import requests import requests
try: try:
@ -137,7 +142,7 @@ def set_webhook(token, url=None, certificate=None, max_connections=None, allowed
if max_connections: if max_connections:
payload['max_connections'] = max_connections payload['max_connections'] = max_connections
if allowed_updates: 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) 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: if timeout:
payload['timeout'] = timeout payload['timeout'] = timeout
if allowed_updates: if allowed_updates:
payload['allowed_updates'] = allowed_updates payload['allowed_updates'] = json.dumps(allowed_updates)
return _make_request(token, method_url, params=payload) return _make_request(token, method_url, params=payload)