Dump int, list and dict parameters as strings for API calls
This commit is contained in:
parent
5a0c658ea3
commit
5927dcd30f
@ -6,6 +6,7 @@ A simple aiohttp asyncronous web client is used to make requests.
|
|||||||
|
|
||||||
# Standard library modules
|
# Standard library modules
|
||||||
import asyncio
|
import asyncio
|
||||||
|
import json
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
# Third party modules
|
# Third party modules
|
||||||
@ -98,8 +99,8 @@ class TelegramBot(object):
|
|||||||
data = aiohttp.FormData()
|
data = aiohttp.FormData()
|
||||||
for key, value in parameters.items():
|
for key, value in parameters.items():
|
||||||
if not (key in exclude or value is None):
|
if not (key in exclude or value is None):
|
||||||
if type(value) is int:
|
if type(value) in (int, dict, list,):
|
||||||
value = str(value)
|
value = json.dumps(value, separators=(',', ':'))
|
||||||
data.add_field(key, value)
|
data.add_field(key, value)
|
||||||
return data
|
return data
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user