Python ebay-sdk:如何改变货币

时间:2017-09-27 10:52:24

标签: python python-3.x ebay-api

我正在使用https://github.com/timotheus/ebaysdk-python连接到ebay api。

我想在ebay的英国版本上列出一个项目,使用我在那里创建的令牌。 所有api呼叫都从.com更改为.co.uk。 我已经将货币从美元改为英镑,但似乎美元是唯一接受的货币。

我在沙盒中运行所有内容。

知道如何解决我的问题吗?

守则:

try:

    api = Trading(config_file=None, domain='api.sandbox.ebay.com',
                  appid=S.EBAY_SANDBOX_APPID, devid=S.EBAY_SANDBOX_DEVID,
                  certid=S.EBAY_SANDBOX_CERTID, token=acc.token)

    myitem = {
        "Item": {
            "Title": item.nazwa,
            "Description": "<![CDATA[{}]]>".format(item.desc),
            "PrimaryCategory": {"CategoryID": "377"},
            "StartPrice": str(round(item.price.amount, 2)),
            "CategoryMappingAllowed": "true",
            "Country": "GB",
            "ConditionID": "3000",
            "Currency": "GBP",
            "DispatchTimeMax": "3",
            "ListingDuration": "Days_{}".format(str(item.len)),
            "ListingType": "FixedPriceItem",
            "PaymentMethods": "PayPal",
            "PayPalEmailAddress": "abc@mail.com",
            "PictureDetails": {"PictureURL": "http://i1.sandbox.ebayimg.com/03/i/00/30/07/20_1.JPG?set_id=8800005007"},
            "PostalCode": "BH104HS",
            "Quantity": str(round(item.qty, 0)),
            "ReturnPolicy": {
                "ReturnsAcceptedOption": "ReturnsAccepted",
                "RefundOption": "MoneyBack",
                "ReturnsWithinOption": "Days_30",
                "Description": "If you are not satisfied, return the goods for refund.",
                "ShippingCostPaidByOption": "Buyer"
            },
            "ShippingDetails": {
                "ShippingType": "Flat",
                "ShippingServiceOptions": {
                    "ShippingServicePriority": "1",
                    "ShippingService": "USPSMedia",
                    "ShippingServiceCost": "4.50"
                }
            },
            "Site": 'UK'
        }
    }
    api.execute('AddFixedPriceItem', myitem)
    print(api)
    dump(api, True)

except ConnectionError as e:
    print(e)
    print(e.response.dict())

回复:

AddFixedPriceItem: Class: RequestError, Severity: Error, Code: 95, Invalid auction currency. The auction currency specified does not match the auction currency for the selected site.' {'Errors': {'ErrorCode': '95', 'ShortMessage': 'Invalid auction currency.', 'SeverityCode': 'Error', 'ErrorClassification': 'RequestError', 'LongMessage': 'The auction currency specified does not match the auction currency for the selected site.'}, 'Build': 'E1031_UNI_API5_18532394_R1', 'Ack': 'Failure', 'Timestamp': '2017-09-25T18:48:34.353Z', 'Version': '1031'}

1 个答案:

答案 0 :(得分:0)

在第3行中,您想要将您的域从ebay US更改为UK。我认为发生了什么事,您正在发送要求英国数据的字典,但是您正在将该请求发送到美国站点。

从这里出发

domain='api.sandbox.ebay.com'

对此

domain='sandbox.ebay.co.uk'

我想对我对您的问题的回答充满信心,但是这可能不是正确的链接本身。如果您查看开发者帐户,则应该可以看到您所在国家/地区的链接。