如何访问令牌自动下载CSV文件
我要刮擦的网站有一个按钮,要求您要下载的数据日期为.csv文件。我已经自动化了此过程以通过Python下载此数据,但是需要每次从Ctrl,Shift,i-> cookies->请求cookie下的浏览器中手动获取令牌,然后将令牌复制并粘贴到Python文件中时间。问题是1天后的令牌时间,并修改到期和/或发行日期不起作用,因此我认为该令牌是由客户端侧JavaScript生成的。
我尝试使用:
response = requests.get(www.exampleurl.com)
print(response.cookies)
我得到一个空的响应。
我也尝试过:
print(response.headers)
但是我根本没有获得cookie或令牌数据。
我想知道我可能会在哪里找到正在生成令牌的客户端JavaScript,以便我可以每次需要一个令牌复制算法或至少运行此JavaScript算法。
与脚本相比,我试图避免使用1GB开销,这是10MB。
The website I'm looking to scrape has a button which asks for dates of the data you want to download as a .csv file. I have automated this process to download this data via python but need to manually get a token each time from the browser under ctrl,shift,i->cookies->request cookies and then copy and paste the token into the python file each time. The problem is the token times out after 1 day and modifying the expiry and/or issue date does not work so I assume this token is being generated by client side javascript.
I have tried using:
response = requests.get(www.exampleurl.com)
print(response.cookies)
And I get an empty response.
I've also tried:
print(response.headers)
But I do not get the cookie or token data at all.
I want to know where I may find the client side javascript which is generating the token so I can copy the algorithm or atleast run this javascript algorithm each time I need a token.
I'm trying to avoid selenium due to it having a 1GB overhead in comparison to the script which would be 10MB.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论