I simplify my requirement to this simple code
from flask import Flask, request
import requests
app = Flask(__name__)
@app.route('/', methods=['POST'])
def root():
payload = {'Message': 'yo','Port':'123'}
r = requests.post("http://127.0.0.1:5000/test", data=payload)
return r.text
@app.route('/test', methods=['POST'])
def test():
return request.form['Message']+','+request.form['Port']
if __name__ == '__main__':
app.run(debug=True)
I've tested the url '127.0.0.1:5000/test' by google's Postman.
I send the data to the url, and It worked, can return the result I wanted.
And I created another .py to test the url, too. It also can show the result I wanted.
import requests
payload = {'Message':'yo','Port':'123'}
r = requests.post("http://127.0.0.1:5000/test", data=payload)
print r.text
Then I put the same code below
@app.route('/', methods=['POST'])
def root():
I want to use the url '127.0.0.1:5000/' to send data to the '127.0.0.1:5000/test' (I also Use google's Postman)
And it can't worked... it always show 'loading...'
Is there a better way to implement my requirement ?
I will thank you so so so much ~!!