gpt4 book ai didi

ruby - 检索 Google Checkout CSV(无 API)

转载 作者:行者123 更新时间:2023-12-04 16:22:27 24 4
gpt4 key购买 nike

我正在尝试检索 Google Checkout 报告(将数据下载到电子表格 (.csv))。不幸的是我不能使用 API(它只保留给英国和美国账户......!)

我有一个用 Mechanize 和 Ruby 制作的脚本,但出现错误:“Net::HTTPBadRequest 1.1 400 Bad Request”。

这是我的代码:

require 'rubygems'
require 'mechanize'
require 'logger'

agent = Mechanize.new { |a| a.log = Logger.new(STDERR) }
agent.user_agent_alias = 'Mac Safari'
page = agent.get 'https://checkout.google.com/sell/orders'

form = page.forms.first
form.Email = 'email@gmail.com'
form.Passwd = 'password'
page = agent.submit(form, form.buttons.first)

form = page.forms.last
p form
form['start-date'] = "2012-11-16"
form['end-date'] = "2012-11-17"
form['column-style'] = "EXPANDED"
#form['_type'] = "order-list-request"
#form['date-time-zone'] = "America/Los_Angeles"
#form['financial-state'] = ""
#form['query-type'] = ""
p form

begin
page = agent.submit(form, form.buttons.first)
rescue Mechanize::ResponseCodeError => ex
puts ex.page.body
end

最佳答案

感谢 pguardiario 和 Charles proxy,我发现了我的错误......有一个多余的字段!

关于ruby - 检索 Google Checkout CSV(无 API),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13443319/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com