问题描述:

I need a simple Client side that can send a bool valu if he is Alive, in a HTTP POST request. I have a Linux server running Apache.

I realized from Atermi(user who helped me), i new to use a requests library, something like this:

import requests

r = requests.post("http://127.0.0.1/post", data={'key': 'val'})

print(r.text)

But I don't know how to make my apache server receive the post requests.

In addition,when running the script I am receiving an error,

The requested URL '/' was not found on this servers.

I tried a server side, for testing in the same linux server and this is the

Code,

 from flask import Flask, request

app = Flask(__name__)

@app.route('/', methods=['POST'])

def res():

print(request.form['key'])

return "Revived"

but recveing the following error:

runtimerror: working outside of the request context

Thanks!

相关阅读:
Top