S
S
spartak8192021-11-13 04:26:50
Python
spartak819, 2021-11-13 04:26:50

How to accept an incoming POST request to my server?

The site sends a POST request to my server, where the data will be specified. How can I get them and how can I save them? Can anyone answer this question or share a link where I can find the answer.
Sorry if this is a stupid question, new to this.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
M
MaratPetrov96, 2021-11-13
@MaratPetrov96

The essence is simple - to save the data from the request form.
But how - depends on the technology of creating an application / site

R
rPman, 2021-11-13
@rPman

You need a web server with support for server scripts (active pages in Microsoft terminology), most likely cgi, a console application is launched on request, post data goes to stdin, request parameters in environment variables, stdout output
in the question is python, as an option you can raise the web server on python itself http.server , request handling in SimpleHTTPRequestHandler class do_POST() method

A
Alexander, 2021-11-13
@shabelski89

The simplest, for example, your web on flask

from flask import Flask
from flask import request

app = Flask(__name__)

@app.route('/url/', methods = ['GET', 'POST'])
def handle_request():
    if request.method == 'POST':
        data = request.form

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question