【问题标题】:How to include Origin in requests? [duplicate]如何在请求中包含 Origin? [复制]
【发布时间】:2020-09-11 16:28:57
【问题描述】:

我想申请一个包含我的原始来源的网站:

Host: https://webwebweb.com
Origin: https://somewebsite.com

我可以通过运行以下命令来请求:

import requests
URL = 'someurl.com'
data =  requests.get(URL)

那么我可以添加哪个参数?

【问题讨论】:

    标签: python http python-requests


    【解决方案1】:

    Origin 是一个标题,所以你可以像这样添加:

    requests.get(
        URL,
        headers={'Origin': ORIGIN}
    )
    

    request 的文档来自请求和http headers

    【讨论】:

      猜你喜欢
      • 2011-09-19
      • 2019-09-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-10-27
      • 2019-12-04
      • 2017-10-06
      相关资源
      最近更新 更多