R
R
Roman2018-07-13 13:12:26
Python
Roman, 2018-07-13 13:12:26

We need to receive data from the Telegram Webhook - what is the equivalent of 'php://input' in Python 3?

Hello.
There is a Python 3 script:
https://anysite.com/cgi-bin/bot.php (this is just an example)
Webhook from Telegram sends data in JSON format via post request
How to get this data into a script for processing?
In PHP I use A in Python 3 how? Do not offer frameworks :) I want to do it on a simple python. Thank you. CGI regular, Apache 2.4
file_get_contents('php://input')

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
SagePtr, 2018-07-13
@procode

The standard input in stdinis (declared in the sys module)
You can do something like this:

import sys
import json
object = json.load(sys.stdin)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question