使用小贩创建出站履行的错误请求

时间:2016-08-01 07:41:31

标签: ruby-on-rails amazon-mws peddler

我正在尝试使用Peddler gem在MWS中创建出站履行。 我得到的唯一反馈是Z3_ast因此有点难以弄清楚出了什么问题。这是调用API的行(解析了值):

# coding=utf-8
"""
chrome --remote-debugging api test
"""

import json
import requests
import websocket

import pdb

def send():
    geturl = requests.get('http://localhost:9222/json')
    websocketURL = json.loads(geturl.content)[0]['webSocketDebuggerUrl']
    request = {}
    request['id'] = 1
    request['method'] = 'Page.navigate'
    request['params'] = {"url": 'http://global.bing.com'}
    ws = websocket.create_connection(websocketURL)
    ws.send(json.dumps(request))
    res = ws.recv()
    ws.close()
    print res

    frameId = json.loads(res)['result']['frameId']
    print frameId
    geturl = requests.get('http://localhost:9222/json')
    websocketURL = json.loads(geturl.content)[0]['webSocketDebuggerUrl']
    req = {}
    req['id'] = 1
    req['method'] = 'Page.getResourceContent'
    req['params'] = {"frameId":frameId,"url": 'http://global.bing.com'}
    header = ["User-Agent: Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36"]
    pdb.set_trace()
    ws = websocket.create_connection(websocketURL,header=header)
    ws.send(json.dumps(req))
    ress = ws.recv()
    ws.close()
    print ress
if __name__ == '__main__':
    send()

我似乎无法弄清楚如何获得200回。有人可以帮忙吗?

实际代码:

Excon::Error::BadRequest (Expected(200) <=> Actual(400 Bad Request)

编辑:经过一番挖掘,我发现了这一点。我尝试将项目数量作为整数和字符串发送,但同样的错误发生:

@client.create_fulfillment_order("186", "186", 2016-08-01T07:35:48Z, "Test shipment number: 186", "Standard", {"Name"=>"Bert the Destroyer", "Line1"=>"Teststreet", "Line2"=>"123", "Line3"=>"", "DistrictOrCounty"=>"", "City"=>"Testcity", "StateOrProvinceCode"=>"CO", "CountryCode"=>"US", "PostalCode"=>"60401", "PhoneNumber"=>"12345678"}, [{"SellerSKU"=>"4785000045", "SellerFulfillmentOrderItemId"=>"4785000045", "Quantity"=>15}], {:fulfillment_policy=>"FillAll", :notification_email_list=>["bertthedestroyer@gmail.com"]})

1 个答案:

答案 0 :(得分:1)

经过更多搜索,我找到了答案。原来这个错误意味着SKU缺货。伟大的错误消息亚马逊! 资源: https://sellercentral.amazon.com/forums/message.jspa?messageID=2745103