From 492657b1e968be9530ebfd3e8f506e71056d0e50 Mon Sep 17 00:00:00 2001 From: ENCRYPTED <48645524+ENCRYPTEDFOREVER@users.noreply.github.com> Date: Sat, 17 Sep 2022 21:08:59 +0300 Subject: [PATCH] Fixed possible incorrect escaping of list[str]. By default if you call str() on collection python will escape strings inside of it using single quotes, which will cause "Can't parse custom emoji identifiers json object" error when calling getCustomEmojiStickers. json.dumps() escapes strings by double quotes so no error occurs. --- aiogram/bot/api.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/aiogram/bot/api.py b/aiogram/bot/api.py index f287e32f..6089dcbf 100644 --- a/aiogram/bot/api.py +++ b/aiogram/bot/api.py @@ -166,7 +166,10 @@ def compose_data(params=None, files=None): if params: for key, value in params.items(): - data.add_field(key, str(value)) + if isinstance(value, (list, dict)): + data.add_field(key, json.dumps(value)) + else: + data.add_field(key, str(value)) if files: for key, f in files.items():