相关疑难解决方法(0)

无法使用Ruby Mechanize登录Amazon

我正在尝试使用Ruby gem Mechanize登录Amazon.我总是被踢回登录页面,没有任何错误消息.我想知道这是否是Mechanize的一个错误,或者亚马逊阻止了这种访问.我有下面的代码,你可以测试.

@mechanizer = Mechanize.new

@mechanizer.user_agent_alias = 'Mac Safari'

@page = @mechanizer.get("https://www.amazon.com/ap/signin?_encoding=UTF8&openid.assoc_handle=usflex&openid.return_to=https%3A%2F%2Fwww.amazon.com%2Fgp%2Fyourstore%3Fie%3DUTF8%26ref_%3Dpd_irl_gw&openid.mode=checkid_setup&openid.ns=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0&openid.claimed_id=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0%2Fidentifier_select&openid.pape.max_auth_age=0&openid.ns.pape=http%3A%2F%2Fspecs.openid.net%2Fextensions%2Fpape%2F1.0&openid.identity=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0%2Fidentifier_select")

form = @page.form_with(:id => "ap_signin_form")

field = form.field_with(:name => "email")
field.value = "fake@email.com"

radiobutton = form.radiobutton_with(:name => 'create', :value => '0')
radiobutton.check

button = form.button_with(:id => "signInSubmit")

@page = form.submit button
Run Code Online (Sandbox Code Playgroud)

谢谢你的帮助.

ruby amazon mechanize

7
推荐指数
1
解决办法
3306
查看次数

标签 统计

amazon ×1

mechanize ×1

ruby ×1