简体   繁体   English

HTTP GET请求在正常会话上有效,但在“隐身”会话中无效

[英]HTTP GET request working on normal session but not in 'incognito' session

Having some trouble understanding why this issue is happening, specifically within the Steam environment. 难以理解为什么会发生此问题,尤其是在Steam环境中。

When I go to this URL and am logged in to Steam, the request goes through fine and I get the return that I'm expecting. 当我转到 URL并登录到Steam时,请求进行得很顺利,并且得到了期望的回报。 However, when I try the request in an incognito session, I get an empty set of results. 但是,当我在隐身会话中尝试该请求时,会得到一组空结果。 I've looked through the code that Steam itself uses to send this request (ctrl-f '// Load' and it should bring you to the relevant code). 我已经查看了Steam本身用于发送此请求的代码 (ctrl -f'// Load',它应该带您到相关代码)。 There doesn't seem to be any identifying information being passed in this request, and even in incognito mode Steam will still load up the price history charts for the item just fine. 在此请求中似乎没有传递任何识别信息,即使在隐身模式下,Steam仍会加载该商品的价格历史记录图表。 I can't understand why the request will not work in a session in which the user isn't logged in to Steam even though the page itself will still display price history using the same request. 我不明白为什么该请求在用户未登录Steam的会话中无法使用,即使页面本身仍会使用同一请求显示价格历史记录。

Since this occurs on Valve's servers, this is simply an educated guess as to what is occurring. 由于这是在Valve的服务器上发生的,因此这仅仅是对所发生情况的有根据的猜测。

When you visit this URL without being logged in, the server is sending back a 400 Bad Request 当您未登录而访问此URL时,服务器将发回400 Bad Request

It appears this is due to the lack of a steamLogin cookie. 看来这是由于缺少steamLogin Cookie steamLogin When you visit the URL without being logged in, these cookies are set 当您未登录而访问URL时,将设置这些cookie

timezoneOffset
Steam_Language
community_game_list_scroll_size
recentlyVisitedAppHubs
sessionid
steamCC_<IP_OF_COMPUTER>

After logging in, when the request is successful, the steamLogin cookie also exists. 登录后,当请求成功时, steamLogin cookie也存在。

It appears you need this cookie to get the information you want. 看来您需要此Cookie才能获取所需的信息。

Can't comment (rep too low) but FYI, the item detail page works because the data for the graph is passed inside the html file in a bracket. 不能发表评论(rep太低),但是仅供参考,项目详细信息页面有效,因为图形的数据在方括号内的html文件中传递。 You could set up a DOM environment, load the html and scrape it out without needing to login. 您可以设置DOM环境,加载html并将其抓取,而无需登录。

As the other poster mentioned, the api call you want to use requires the steamLogin cookie to work. 如其他海报所述,您要使用的api调用要求steamLogin cookie起作用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM