I have a problem coding a bot in Python that works with the new inline mode.
The bot gets the query, and while trying to answer, it receives error 400.
Here is a sample of data sent by the bot at this time:
{
'inline_query_id': '287878416582808857',
'results': [
{
'type': 'article',
'title': 'Convertion',
'parse_mode': 'Markdown',
'id': '287878416582808857/0',
'message_text': 'blah blah'
}
]
}
I use requests library in to make requests, and here is the line that does it in the code:
requests.post(url = "https://api.telegram.org/bot%s%s" % (telegram_bot_token, "/answerInlineQuery"), data = myData)
With myData
holding the data described in the sample.
Can you help me solve this, please?
2
Answers
I suspect it is because you haven’t JSON-serialized the
results
parameter.Note that I use
params
to supply the data.I am getting the correct response after doing some POC. I am using java
com.github.pengrad
.Below the code.
Below the console output:
And I am getting proper response in my mobile telegram app also.