From 5927dcd30fa202a2b431c58a290e289a57c4ba6e Mon Sep 17 00:00:00 2001 From: Davte Date: Mon, 1 Jul 2019 15:54:25 +0200 Subject: [PATCH] Dump int, list and dict parameters as strings for API calls --- davtelepot/api.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/davtelepot/api.py b/davtelepot/api.py index de899e4..8cfd476 100644 --- a/davtelepot/api.py +++ b/davtelepot/api.py @@ -6,6 +6,7 @@ A simple aiohttp asyncronous web client is used to make requests. # Standard library modules import asyncio +import json import logging # Third party modules @@ -98,8 +99,8 @@ class TelegramBot(object): data = aiohttp.FormData() for key, value in parameters.items(): if not (key in exclude or value is None): - if type(value) is int: - value = str(value) + if type(value) in (int, dict, list,): + value = json.dumps(value, separators=(',', ':')) data.add_field(key, value) return data