我正在使用Jupyter Notebook。
我的烧瓶代码:
from flask import Flask, jsonify, request
import json
import requests
app = Flask(__name__)
@app.route('/details', methods=['GET','POST'])
def home():
data = request.form
return jsonify(data)
if __name__ == '__main__':
app.run(debug=True)
它工作正常,但是每当我运行request.post()代码时,它都会卡住(In [*])
代码是:
import requests
payload = {'A': 'B','C': 'D'}
r = requests.post('http://127.0.0.1:5000/details',data=payload)
print(r.text)