【问题标题】:How can I perfectly copy a POST request?如何完美复制 POST 请求?
【发布时间】:2020-06-13 14:18:30
【问题描述】:

假设我使用 chrome 开发人员工具收到了一个 POST 请求。如何准确复制该 POST 请求,以便可以使用 python requests 模块发送完全相同的请求。

【问题讨论】:

    标签: python python-3.x http post python-requests


    【解决方案1】:

    试试:

    1. 打开chrome开发者工具->右键->复制->复制为cURL
    2. curl命令翻译成Pythonrequests在线here或使用uncurl包:
    import uncurl
    
    print(uncurl.parse("curl 'https://pypi.python.org/pypi/uncurl' -H 'Accept-Encoding: gzip,deflate,sdch'"))
    
    # output:
    'requests.get("https://pypi.python.org/pypi/uncurl", headers={
        "Accept-Encoding": "gzip,deflate,sdch",
    })'
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2018-12-05
      • 2016-11-16
      • 2018-03-26
      • 1970-01-01
      • 2020-05-26
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多