无法使用Curl将查询复制到Amazon Manage Kindle.我想念什么? [英] Unable to replicate query to Amazon Manage Kindle using Curl. What am I missing?

查看:144
本文介绍了无法使用Curl将查询复制到Amazon Manage Kindle.我想念什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于亚马逊的管理您的Kindle"的网络界面极其缓慢,我试图弄清楚如何构建一个应用程序,该应用程序可以连接到提供给管理页面的无证服务.现在,我已经确定了要使用哪些URL和参数来检索执行CRUD操作所需的JSON数据,但是我一直无法使用CURL成功地对任何服务发布数据.

Due to the horrendously slow web interface of Amazon's "Manage your Kindle", I am trying to figure out how to build an app that connects to the undocumented services that feed the management page. I have now established which URLs and parameters to use in order to retrieve the JSON data needed to do CRUD operations, but I am stuck at being unable to successfully POST data the any of the services using CURL.

身份验证似乎有问题,但是我正在发送我可以找到的所有相关标头和cookie.仍然获得

There seems to be a problem with authentication, but I am sending all the relevant headers and cookies I can find. Still get a

HTTP/1.1 302 MovedTemporarily
Location: https://www.amazon.com/ap/signin?_encoding=UTF8&accountStatusPolicy=P1&openid.assoc_handle=usflex&openid.claimed_id=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0%2Fidentifier_select&openid.identity=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0%2Fidentifier_select&openid.mode=checkid_setup&openid.ns=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0&openid.ns.pape=http%3A%2F%2Fspecs.openid.net%2Fextensions%2Fpape%2F1.0&openid.pape.max_auth_age=900&openid.return_to=https%3A%2F%2Fwww.amazon.com%2Fgp%2Fdigital%2Ffiona%2Fmanage%2Ffeatures%2Forder-history%2Fajax%2FqueryPdocs.html%3Fie%3DUTF8%26contentType%3DPersonal%2520Documents%26count%3D15%26offset%3D0 

发送此请求后,该请求应列出所有个人文件. Cookie已使用Chrome的Web开发人员工具复制.

After sending this request, which is supposed to list all personal documents. The cookies have been copied using Chrome's Web Developer Tools.

> POST /gp/digital/fiona/manage/features/order-history/ajax/queryPdocs.html HTTP/1.1
> User-Agent: curl/7.24.0 (x86_64-apple-darwin12.0) libcurl/7.24.0 OpenSSL/0.9.8r zlib/1.2.5
> Host: www.amazon.com
> Accept: */*
> Cookie: session-token=8tAmbclc1/ZjtWU8o5VXyU5H8s0/Yiy346W1/Nx4Sz2BzTUWUR9lkwDABzzgRW1lwZUqcu8MqhGzbby2Xg9RA8Y0cwpLRDk5sf6eXUwNQBvZAcgEXsHG8Bj+24q2C1MZ9v5hFrzBNr6pDP+9CYXrMl2WaEVzmvd/sBO69jk5o3mK3PJf1leY6YhLAL3W8dVj89O+ebIoaPvLHP7naDpImbqaa5bwGS4ki+AzJDLAHs5UMwQkiuXoUCnukz1+WqCr0rHhKoPkI17WGm6MrRDs9/PC2ll7+qDU13; session-id=184-5755217-1234567; session-id-time=2082787201l
> Content-Length: 48
> Content-Type: application/x-www-form-urlencoded

(是的,我在在线发布此内容之前更改了会话令牌和会话ID:p)

(Yes, I changed my session token and session id before posting this online :p )

我在CLI上使用以下调用,并将cookie存储在cookie3.txt中

I use the following call on the CLI and have stored the cookies in cookie3.txt

curl -v --cookie cookie3.txt  --data 'offset=0&count=15&contentType=Personal+Documents' 'https://www.amazon.com/gp/digital/fiona/manage/features/order-history/ajax/queryPdocs.html' 

有什么想法让我无法在这里工作吗?

Any idea what I am missing here to get it working?

推荐答案

Amazon似乎最能实现通过隐蔽性实现安全性;如果您的用户代理不是公认的浏览器(例如Firefox,Chrome或IE),则只会被拒绝访问.为了获得请求,需要伪造用户代理.

It seems that Amazon does it best to implement Security Through Obscurity; if your user agent is not a recognized browser, such as Firefox, Chrome or IE, you will simply be refused access. In order to get requests through one needs to fake the user agent.

我最终放弃了Python和Requests库的cURL.进入FIONA所需的所有必要步骤都可以在 GitHub上的代码中查看.

I ended up abandoning cURL for Python and the Requests library. All the required steps needed for getting into FIONA can be seen in the code on GitHub.

这篇关于无法使用Curl将查询复制到Amazon Manage Kindle.我想念什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆