为什么request.post()在Jupyter Notebook上不起作用?

时间:2020-10-13 11:55:54

标签: python api flask python-requests jupyter-notebook

我正在使用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)

0 个答案:

没有答案