无法使用Python登录到Amazon

2024-10-01 15:29:08 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在使用python3编写一个脚本来登录Amazon来获取我的Kindle亮点。它基于本文:https://blog.jverkamp.com/2015/07/02/scraping-kindle-highlights/

我无法成功登录,而是收到一条消息,说要启用cookies继续:

<RequestsCookieJar[<Cookie ubid-main=189-4768762-8531647 for .amazon.com/>]>
Failed to login: 

Please Enable Cookies to Continue

To continue shopping at Amazon.com, please enable cookies in your Web browser.
Learn more about cookies and how to enable them.

我已经包含了处理cookies的请求会话,但似乎不起作用。在

下面是我尝试执行此操作的代码:

^{pr2}$

我在使用会话的过程中是否遗漏了什么?在


Tags: tohttps亮点脚本comamazonenableblog
1条回答
网友
1楼 · 发布于 2024-10-01 15:29:08

您的登录表单数据实际上不正确,应该是电子邮件密码

signin_data[u'email'] = 'your_email'
signin_data[u'password'] = 'your_password'

您还可以使用css select避免尝试,并具有以下属性:

^{pr2}$

输出的第一行,您可以在末尾看到<title>Amazon Kindle: Home</title>

b'<?xml version="1.0" encoding="utf-8"?>\n<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\n<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US">\n  <head>\n    <title>Amazon Kindle: Home</title>\n  

如果它仍然不起作用,您应该更新您的请求版本,并可能尝试其他用户代理。一旦我更改了ap_emailap_password,我就可以正常登录了。在

相关问题 更多 >

    热门问题