Skip to content
This repository was archived by the owner on Apr 2, 2024. It is now read-only.
This repository was archived by the owner on Apr 2, 2024. It is now read-only.

Order.create uses an invalid URL #78

@tlaredo

Description

@tlaredo

When I try running shippo.Order.create(...), I get the following error:

shippo.error.APIConnectionError: Unexpected error communicating with Shippo. It looks like there's
probably a configuration issue locally.  If this problem persists, let
us know at support@goshippo.com.

(Network error: A CannotOverwriteExistingCassetteException was raised with error message Can't overwrite existing cassette ('tests/fixtures/cassettes/tests/rest/admin/test_regenerate_label/TestRegenerateLabel/test_label_regeneration.yaml') in your current record mode (<RecordMode.ONCE: 'once'>).
No match for the request (<Request (POST) https://api.goshippo.com/orders/>) was found.
Found 7 similar requests with 1 different matcher(s) :

1 - (<Request (POST) https://api.goshippo.com/v1/shipments/>).
Matchers succeeded : ['method', 'scheme', 'host', 'port', 'query']
Matchers failed :
path - assertion failure :
/orders/ != /v1/shipments/

2 - (<Request (POST) https://api.goshippo.com/v1/shipments/>).
Matchers succeeded : ['method', 'scheme', 'host', 'port', 'query']
Matchers failed :
path - assertion failure :
/orders/ != /v1/shipments/

3 - (<Request (POST) https://api.goshippo.com/v1/shipments/>).
Matchers succeeded : ['method', 'scheme', 'host', 'port', 'query']
Matchers failed :
path - assertion failure :
/orders/ != /v1/shipments/

4 - (<Request (POST) https://api.goshippo.com/v1/transactions/>).
Matchers succeeded : ['method', 'scheme', 'host', 'port', 'query']
Matchers failed :
path - assertion failure :
/orders/ != /v1/transactions/

5 - (<Request (POST) https://api.goshippo.com/v1/orders/>).
Matchers succeeded : ['method', 'scheme', 'host', 'port', 'query']
Matchers failed :
path - assertion failure :
/orders/ != /v1/orders/

6 - (<Request (POST) https://api.goshippo.com/v1/shipments/>).
Matchers succeeded : ['method', 'scheme', 'host', 'port', 'query']
Matchers failed :
path - assertion failure :
/orders/ != /v1/shipments/

7 - (<Request (POST) https://api.goshippo.com/v1/transactions/>).
Matchers succeeded : ['method', 'scheme', 'host', 'port', 'query']
Matchers failed :
path - assertion failure :
/orders/ != /v1/transactions/
)
> /Users/tlaredo/src/whatnot_backend/.venv/lib/python3.9/site-packages/shippo/resource.py(188)create()
-> response, api_key = requestor.request('post', url, params)

This is because the cls_url method on the Order object doesn't have the v1 prefix:

@classmethod
    def class_url(cls):
        cls_name = cls.class_name()
        return "%ss/" % (cls_name,)

Instead, it should be this:

@classmethod
    def class_url(cls):
        cls_name = cls.class_name()
        return "v1/%ss/" % (cls_name,)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions