首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >Shippo - Python包异步问题

Shippo - Python包异步问题
EN

Stack Overflow用户
提问于 2019-03-15 03:41:35
回答 1查看 293关注 0票数 1

我已经导入了Shippo python包,我正在尝试让他们的示例正常工作,但我遇到了以下错误消息(见下文)。我在最新的API版本上运行Python 3.7.2。

以下是错误-

    Traceback (most recent call last):
      File "c:/Users/tom/Documents/PyProjects/goShippo/goShippoCreateLabels.py", line 1, in <module>
        import shippo
      File "C:\Python\lib\site-packages\shippo\__init__.py", line 8, in <module>
        from shippo.resource import (
      File "C:\Python\lib\site-packages\shippo\resource.py", line 303
        def get_rates(cls, object_id, async=False, api_key=None, currency=None, **params):
                                      ^
SyntaxError: invalid syntax

这是代码-

import shippo

shippo.api_key = "shippo_test_123456789"

address_from = {
    "name": "Shawn Ippotle",
    "company": "Shippo",
    "street1": "215 Clayton St.",
    "city": "San Francisco",
    "state": "CA",
    "zip": "94117",
    "country": "US",
    "phone": "+1 555 341 9393",
    "email": "shippotle@goshippo.com"
}

address_to = {
    "name": "Mr Hippo",
    "company": "",
    "street1": "Broadway 1",
    "street2": "",
    "city": "New York",
    "state": "NY",
    "zip": "10007",
    "country": "US",
    "phone": "+1 555 341 9393",
    "email": "mrhippo@goshippo.com",
    "metadata": "Hippos dont lie"
}

parcel = {
    "length": "5",
    "width": "5",
    "height": "5",
    "distance_unit": "in",
    "weight": "2",
    "mass_unit": "lb"
}

shipment = {
    "address_from": address_from,
    "address_to": address_to,
    "parcels": [parcel]
}

transaction = shippo.Transaction.create(
    shipment = shipment,
    carrier_account = "b741b99f95e841639b54272834bc478c",
    servicelevel_token = "usps_priority"
)
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/55170794

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档