8.7 【绝佳工具 03】HTTP接口调试:Test RESTful Web Service ========================================================= |image0| PyCharm 的 Test RESTful Web Service工具提供了RESTful接口测试界面,如下图所示,提供了get、post,put等http方法,其中的Request子界面headers,Parameters,Body等功能,Response子界面用于显示返回值,Response Headers用于显示返回的消息头。 为了演示,我先使用 Flask 写一个 HTTP 接口 .. code:: python from flask import Flask, request app = Flask(__name__) @app.route('/hello') def index(): name = request.args.get('name') return '你好,' + name if __name__ == '__main__': app.run() 并运行它开启服务,访问地址是:http://127.0.0.1:5000/ |image1| 通过下图方式打开 ``Test RESTful Web Service`` |image2| 会出现如下界面,在红框处填写如下信息 |image3| 然后点击最左边的运行按钮,即可向服务器发送 http 请求。 |image4| |image5| .. |image0| image:: http://image.iswbm.com/20200804124133.png .. |image1| image:: http://image.iswbm.com/20200825075118.png .. |image2| image:: http://image.iswbm.com/20200825073354.png .. |image3| image:: http://image.iswbm.com/20200825075226.png .. |image4| image:: http://image.iswbm.com/20200825075434.png .. |image5| image:: https://open.weixin.qq.com/qr/code?username=idealyard