饼干仅设置在本地机器上

发布于 2025-02-04 06:39:52 字数 594 浏览 2 评论 0原文

我正在尝试获取一个需要多个cookie工作的端点。 因此,我的请求看起来像这样:

    cookiestring="key1=value1;key2=value2;key3=value3;"
    headers = {"Cookie" : cookiestring}
    url = f"https://steamcommunity.com/market/pricehistory/?appid=730&market_hash_name={market_hash_name}"
    response = requests.get(url, headers=headers)
    data = response.json()
    print(response.status_code)

在笔记本电脑上执行此操作(在其中我可以通过浏览器登录以获取cookie的键值对)。使用Postman,请求也可以正常工作。

将脚本部署到根服务器(Ubuntu)时,它将不再起作用,我不知道为什么。该代码复制粘贴,并且完全相同。

关于如何解决此问题或进一步调试的任何想法?

提前致谢

I am trying to fetch an endpoint which needs multiple cookies to work.
So my request looks like this:

    cookiestring="key1=value1;key2=value2;key3=value3;"
    headers = {"Cookie" : cookiestring}
    url = f"https://steamcommunity.com/market/pricehistory/?appid=730&market_hash_name={market_hash_name}"
    response = requests.get(url, headers=headers)
    data = response.json()
    print(response.status_code)

When executing this on my laptop (in which I can log in via the browser to get the key-value pairs for the cookies) it works fine. Using PostMan, the request also works fine.

When deploying the script to a root-server (ubuntu) It won't work anymore and I have no Idea why. The code is copy pasted and the exact same.

Any Ideas on how to fix this or to further debug?

Thanks in Advance

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文