├── .circleci
└── config.yml
├── .github
└── workflows
│ └── sdk-test.yml
├── .gitignore
├── HISTORY.rst
├── LICENSE
├── README.md
├── contributors.txt
├── examples
├── basic-shipment.py
├── batch.py
├── estimate-shipping-prices.py
├── filter-by-delivery-time.py
├── get-rates-to-show-customer.py
├── international-shipment.py
├── multi_piece_shipment.py
├── order-lineitem.py
├── pickup.py
├── purchase-fastest-service.py
└── tracking.py
├── setup.py
├── shippo
├── __init__.py
├── api_requestor.py
├── certificate_blacklist.py
├── config.py
├── error.py
├── http_client.py
├── resource.py
├── test
│ ├── __init__.py
│ ├── fixtures
│ │ ├── address
│ │ │ ├── test_create
│ │ │ ├── test_invalid_create
│ │ │ ├── test_invalid_retrieve
│ │ │ ├── test_invalid_validate
│ │ │ ├── test_list_all
│ │ │ ├── test_list_page_size
│ │ │ ├── test_retrieve
│ │ │ └── test_validate
│ │ ├── batch
│ │ │ ├── test_add
│ │ │ ├── test_create
│ │ │ ├── test_invalid_add
│ │ │ ├── test_invalid_create
│ │ │ ├── test_invalid_purchase
│ │ │ ├── test_invalid_remove
│ │ │ ├── test_invalid_retrieve
│ │ │ ├── test_purchase
│ │ │ ├── test_remove
│ │ │ └── test_retrieve
│ │ ├── customs-declaration
│ │ │ ├── test_create
│ │ │ ├── test_invalid_create
│ │ │ ├── test_invalid_retrieve
│ │ │ ├── test_list_all
│ │ │ ├── test_list_page_size
│ │ │ └── test_retrieve
│ │ ├── customs-item
│ │ │ ├── test_create
│ │ │ ├── test_invalid_create
│ │ │ ├── test_invalid_retrieve
│ │ │ ├── test_list_all
│ │ │ ├── test_list_page_size
│ │ │ └── test_retrieve
│ │ ├── manifest
│ │ │ ├── test_create
│ │ │ ├── test_invalid_create
│ │ │ ├── test_invalid_retrieve
│ │ │ ├── test_list_all
│ │ │ ├── test_list_page_size
│ │ │ └── test_retrieve
│ │ ├── order
│ │ │ ├── test_create
│ │ │ ├── test_invalid_create
│ │ │ ├── test_invalid_retrieve
│ │ │ ├── test_list_all
│ │ │ ├── test_list_page_size
│ │ │ └── test_retrieve
│ │ ├── parcel
│ │ │ ├── test_create
│ │ │ ├── test_invalid_create
│ │ │ ├── test_invalid_retrieve
│ │ │ ├── test_list_all
│ │ │ ├── test_list_page_size
│ │ │ └── test_retrieve
│ │ ├── pickup
│ │ │ └── test_create
│ │ ├── rate
│ │ │ ├── test_invalid_retrieve
│ │ │ └── test_retrieve
│ │ ├── shipment
│ │ │ ├── test_create
│ │ │ ├── test_get_rate
│ │ │ ├── test_get_rates_blocking
│ │ │ ├── test_invalid_create
│ │ │ ├── test_invalid_get_rate
│ │ │ ├── test_invalid_retrieve
│ │ │ ├── test_list_all
│ │ │ ├── test_list_page_size
│ │ │ └── test_retrieve
│ │ ├── track
│ │ │ ├── test_create
│ │ │ ├── test_get_status
│ │ │ ├── test_invalid_create
│ │ │ └── test_invalid_get_status
│ │ └── transaction
│ │ │ ├── test_create
│ │ │ ├── test_invalid_create
│ │ │ ├── test_invalid_retrieve
│ │ │ ├── test_list_all
│ │ │ ├── test_list_page_size
│ │ │ └── test_retrieve
│ ├── helper.py
│ ├── integration
│ │ ├── __init__.py
│ │ └── test_integration.py
│ ├── test_address.py
│ ├── test_api_requestor.py
│ ├── test_batch.py
│ ├── test_customs_declaration.py
│ ├── test_customs_item.py
│ ├── test_http_client.py
│ ├── test_manifest.py
│ ├── test_order.py
│ ├── test_parcel.py
│ ├── test_pickup.py
│ ├── test_rate.py
│ ├── test_shipment.py
│ ├── test_track.py
│ └── test_transaction.py
├── util.py
└── version.py
└── tox.ini
/.circleci/config.yml:
--------------------------------------------------------------------------------
1 | orbs: # declare what orbs we are going to use
2 | node: circleci/python@1.5.0
3 |
4 | # Use the latest 2.1 version of CircleCI pipeline process engine.
5 | # See: https://circleci.com/docs/2.0/configuration-reference
6 |
7 | version: 2.1
8 |
9 | jobs:
10 | build:
11 | working_directory: ~/repo
12 |
13 | # Primary container image where all commands run
14 |
15 | docker:
16 | - image: circleci/python:3.6.5 # primary container for the build job
17 | auth:
18 | username: mydockerhub-user
19 | password: $DOCKERHUB_PASSWORD
20 |
21 | steps:
22 | - checkout
23 | - run:
24 | name: Install Dependencies
25 | command: | # use pipenv to install dependencies
26 | sudo pip install pipenv
27 | pipenv install
28 |
29 | - run:
30 | name: Install goShippo
31 | command: pipenv run python setup.py install
32 | - run:
33 | name: Test
34 | command: pipenv run python -W always setup.py test
35 |
--------------------------------------------------------------------------------
/.github/workflows/sdk-test.yml:
--------------------------------------------------------------------------------
1 | name: Python SDK Test
2 |
3 | on:
4 | # Run the tests on every push to the master branch
5 | push:
6 | branches: [ "master" ]
7 |
8 | # Run the tests for the default branch [master] every Monday 3:00 pm UTC time (8:00 am PST)
9 | schedule:
10 | - cron: "0 15 * * 1"
11 |
12 | # Run the tests by clicking a button in GitHub's UI
13 | workflow_dispatch:
14 |
15 |
16 | jobs:
17 | test:
18 | runs-on: ubuntu-20.04
19 | strategy:
20 | fail-fast: false
21 | matrix:
22 | python: ["3.6", "3.7", "3.8", "3.9"]
23 |
24 | steps:
25 | - uses: actions/checkout@v3
26 | - name: Setup Python
27 | uses: actions/setup-python@v3
28 | with:
29 | python-version: ${{ matrix.python }}
30 | - name: Install tox
31 | run: pip install tox
32 | - id: test
33 | name: Run the tests for PROD
34 | env:
35 | SHIPPO_API_KEY: ${{ secrets.SHIPPO_PROD_TEST_KEY }}
36 | SHIPPO_API_BASE: ${{ secrets.SHIPPO_PROD_API_BASE }}
37 | run: tox -e py
38 | - name: Send a Slack notification saying if tests are passing/failing for a given Python version
39 | if: always()
40 | shell: bash
41 | env:
42 | SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
43 | run: |
44 | conclusion=${{ steps.test.conclusion }}
45 |
46 | if [[ "$conclusion" == "success" ]]; then
47 | message="✅ Python SDK Test succeeded [Env: PROD, Python version: ${{ matrix.python }}]"
48 | else
49 | message="❌ Python SDK Test failed [Env: PROD, Python version: ${{ matrix.python }}]"
50 | fi
51 |
52 | curl -X POST --data-urlencode "payload={\"text\": \"$message\", \"link_names\": 1}" $SLACK_WEBHOOK_URL
53 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 | /dist
3 | /MANIFEST
4 | /shippo.egg-info
5 | *.pyc
6 | *.egg
7 | .eggs/
8 | *.class
9 | .venv
10 | .vscode
11 | .idea
12 | shippo/test/shippo
13 | venv
14 | .python-version
15 |
16 | # Unit test / coverage reports
17 | .tox/
18 | .coverage
19 | .cache
20 | nosetests.xml
21 | coverage.xml
22 |
--------------------------------------------------------------------------------
/HISTORY.rst:
--------------------------------------------------------------------------------
1 | Release History
2 | ---------------
3 |
4 | **Order and User Agent Additions**
5 |
6 | - Include Order and LineItem object (#69)
7 | - Change user-agent format
8 |
9 | Release History
10 | ---------------
11 |
12 | 2.1.2 (2022-02-28)
13 | 2.1.1 (2022-02-28) [--removed](https://pypi.org/manage/project/shippo/history/)
14 |
15 | **Dependency Version Bumps**
16 |
17 | - Allow requests version to be higher (2.27.1)
18 |
19 | Release History
20 | ---------------
21 |
22 | 2.1.0 (2022-01-18)
23 |
24 | **New features**
25 |
26 | - Added support for Pickup and Order Objects
27 | - Converted testing to CircleCi
28 |
29 | Release History
30 | ---------------
31 |
32 | 2.0.2 (2020-11-05)
33 |
34 | **Dependency Version Bumps**
35 |
36 | - Allow simplejson version to be higher (3.17.2)
37 | - Allow requests version to be higher (2.24.0)
38 |
39 | Release History
40 | ---------------
41 |
42 | 2.0.1 (2020-9-21)
43 |
44 | **Improvements**
45 |
46 | - Add Webhook Class
47 | - Add multi-piece shipment & webhook examples
48 |
49 | Release History
50 | ---------------
51 |
52 | 2.0.0 (2020-01-10)
53 |
54 | **Behavioural Changes**
55 |
56 | - Update default API version to 2018-02-08. For more information on versioning and upgrading your version, please refer to https://goshippo.com/docs/versioning
57 |
58 | 2.0.0rc1 (2019-05-06)
59 | +++++++++++++++++++
60 |
61 | **Behavioural Changes**
62 |
63 | - Drop support for Python < 3.5
64 | - Drop `async` and `sync` parameters in favour of `asynchronous`
65 | - Move configurations to `shippo.config`
66 |
67 | 1.5.1 (2017-04-10)
68 | +++++++++++++++++++
69 |
70 | **Behavioural Changes**
71 |
72 | - Remove unnecessary email fields and amend parcel fields to match the new version
73 |
74 | 1.5.0 (2017-03-29)
75 | +++++++++++++++++++
76 |
77 | **Behavioural Changes**
78 |
79 | - The client now only supports the most recent version of the Shippo API (2017-03-29). For more information on versioning and upgrading your version, please refer to https://goshippo.com/docs/versioning
80 |
81 | 1.4.0 (2017-01-19)
82 | +++++++++++++++++++
83 |
84 | **Improvements**
85 |
86 | - SSL cert verification is now enabled by default
87 |
88 | 1.3.0 (2017-01-18)
89 | +++++++++++++++++++
90 |
91 | **New features**
92 |
93 | - Added support for Track and Batch Objects
94 |
95 | 1.2.4 (2016-10-11)
96 | +++++++++++++++++++
97 |
98 | **Bugfixes**
99 |
100 | - Change the API version header name
101 |
102 | 1.2.3 (2016-09-27)
103 | +++++++++++++++++++
104 |
105 | **Minor Improvements**
106 |
107 | - Fix relative imports for Python 3
108 |
109 | 1.2.2 (2016-08-1)
110 | +++++++++++++++++++
111 |
112 | **Minor Improvements**
113 |
114 | - Only show DeprecationWarning for shippo package.
115 |
116 | 1.2.1 (2016-06-13)
117 | +++++++++++++++++++
118 |
119 | **Bugfixes**
120 |
121 | - add version to shippo
122 |
123 | 1.2.0 (2016-06-13)
124 | +++++++++++++++++++
125 |
126 | **Improvements**
127 |
128 | - Removed polling for shipments and transactions calls
129 | - Fixed and added tests
130 |
131 | **Behavioural Changes**
132 |
133 | - [WARNING] Changed keyword for creating shipments and transactions synchronously from `sync=True` to `async=False`
134 |
135 | **Minor Improvements**
136 |
137 | - Added fixtures to our tests using vcr
138 | - Added Travis-CI
139 | - Added badges to the README
140 | - Bumped unittest version
141 |
142 | 1.1.1 (2015-11-12)
143 | +++++++++++++++++++
144 |
145 |
146 | 1.1.0 (2015-06-12)
147 | +++++++++++++++++++
148 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License
2 |
3 | Copyright (c) 2020 Shippo (http://goshippo.com)
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in
13 | all copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 | THE SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Shippo API Python wrapper
2 |
3 | ---
4 |
5 | :warning: **Shippo no longer actively maintains this library**
6 |
7 | Use our latest [Shippo Python SDK](https://github.com/goshippo/shippo-python-sdk) 🚀
8 |
9 | ---
10 |
11 | [](https://badge.fury.io/py/shippo)
12 | [](https://travis-ci.org/goshippo/shippo-python-client)
13 |
14 | Shippo is a shipping API that connects you with [multiple shipping carriers](https://goshippo.com/carriers/) (such as USPS, UPS, DHL, Canada Post, Australia Post, UberRUSH and many others) through one interface.
15 |
16 | Print a shipping label in 10 mins using our default USPS and DHL Express accounts. No need to register for a carrier account to get started.
17 |
18 | You will first need to [register for a Shippo account](https://goshippo.com/) to use our API. It's free to sign up, free to use the API. Only pay to print a live label, test labels are free.
19 |
20 | ### Migrating to V2
21 |
22 | #### Configuration
23 |
24 | Configurable variables previously available in the main module (ex: `shippo.api_key`) have been moved to the `shippo.config` module.
25 |
26 | ```python
27 |
28 | import shippo
29 |
30 | shippo.config.api_key = ""
31 | shippo.config.api_version = "2018-02-08"
32 | shippo.config.verify_ssl_certs = True
33 | shippo.config.rates_req_timeout = 30.0
34 | shippo.config.timeout_in_seconds = None
35 | # default timeout set in the above line is:
36 | # 80 seconds for RequestsClient
37 | # 55 seconds for UrlFetchClient
38 | shippo.config.app_name = "Name of your Application" # Not required
39 | shippo.config.app_version = "Version of Application" # Not required
40 | ```
41 |
42 |
43 |
44 | ### How do I get set up?
45 |
46 | #### To install from the source file:
47 |
48 | ```
49 | #!shell
50 | python setup.py install
51 | ```
52 |
53 | or pip (https://pip.pypa.io/en/latest/index.html):
54 |
55 | ```
56 | #!shell
57 | sudo pip install shippo
58 | ```
59 |
60 | #### To test:
61 |
62 | Set your `SHIPPO_API_KEY` as an environment variable.
63 | e.g. on OSX:
64 |
65 | `export SHIPPO_API_KEY=""`
66 |
67 | Optionally, set your `APP_NAME` and `APP_VERSION` as environment variables, e.g.:
68 |
69 | ```
70 | export APP_NAME=MyAwesomeApp
71 | export APP_VERSION=1.0.0
72 | ```
73 |
74 | Run the test with the following command:
75 |
76 | ```
77 | #!shell
78 | python setup.py test --test-suite=shippo
79 | ```
80 |
81 | #### Using the API:
82 |
83 | ```python
84 |
85 | import shippo
86 | shippo.config.api_key = ""
87 |
88 | address1 = shippo.Address.create(
89 | name='John Smith',
90 | street1='6512 Greene Rd.',
91 | street2='',
92 | company='Initech',
93 | phone='+1 234 346 7333',
94 | city='Woodridge',
95 | state='IL',
96 | zip='60517',
97 | country='US',
98 | metadata='Customer ID 123456'
99 | )
100 |
101 | print 'Success with Address 1 : %r' % (address1, )
102 |
103 | ```
104 |
105 | We've created a number of examples to cover the most common use cases. You can find the sample code files in the [examples folder](examples/).
106 | Some of the use cases we covered include:
107 |
108 | - [Basic domestic shipment](examples/basic-shipment.py)
109 | - [International shipment](examples/international-shipment.py) - Custom forms, interntational destinations
110 | - [Price estimation matrix](examples/estimate-shipping-prices.py)
111 | - [Retrieve rates, filter by delivery time and purchase cheapest label](examples/filter-by-delivery-time.py)
112 | - [Retrieve rates, purchase label for fastest delivery option](examples/purchase-fastest-service.py)
113 | - [Retrieve rates so customer can pick preferred shipping method, purchase label](examples/get-rates-to-show-customer.py)
114 |
115 | ## Documentation
116 |
117 | Please see [https://goshippo.com/docs](https://goshippo.com/docs) for complete up-to-date documentation.
118 |
119 | ## About Shippo
120 |
121 | Connect with multiple different carriers, get discounted shipping labels, track parcels, and much more with just one integration. You can use your own carrier accounts or take advantage of our discounted rates with the USPS and DHL Express. Using Shippo makes it easy to deal with multiple carrier integrations, rate shopping, tracking and other parts of the shipping workflow. We provide the API and dashboard for all your shipping needs.
122 |
123 | ## Supported Features
124 |
125 | The Shippo API provides in depth support of carrier and shipping functionalities. Here are just some of the features we support through the API:
126 |
127 | - Shipping rates & labels - [Docs](https://goshippo.com/docs/first-shipment)
128 | - Tracking for any shipment with just the tracking number - [Docs](https://goshippo.com/docs/tracking)
129 | - Batch label generation - [Docs](https://goshippo.com/docs/batch)
130 | - Multi-piece shipments - [Docs](https://goshippo.com/docs/multipiece)
131 | - Manifests and SCAN forms - [Docs](https://goshippo.com/docs/manifests)
132 | - Customs declaration and commercial invoicing - [Docs](https://goshippo.com/docs/international)
133 | - Address verification - [Docs](https://goshippo.com/docs/address-validation)
134 | - Consolidator support including:
135 | _ DHL eCommerce
136 | _ UPS Mail Innovations \* FedEx Smartpost
137 | - Additional services: cash-on-delivery, certified mail, delivery confirmation, and more - [Docs](https://goshippo.com/docs/reference#shipment-extras)
138 |
--------------------------------------------------------------------------------
/contributors.txt:
--------------------------------------------------------------------------------
1 | Eyoel Asfaw
2 | Subhi Beidas
3 | Matthieu Nowicki
4 | Steve Byerly
5 | Malcolm Rebughini
6 | Matthew Hwang
7 |
--------------------------------------------------------------------------------
/examples/basic-shipment.py:
--------------------------------------------------------------------------------
1 | import shippo
2 |
3 | """
4 | In this tutorial we have an order with a sender address,
5 | recipient address and parcel information that we need to ship.
6 | """
7 |
8 | # Replace with your key
9 | shippo.config.api_key = ""
10 |
11 | # Example address_from object dict
12 | # The complete reference for the address object is available here: https://goshippo.com/docs/reference#addresses
13 | address_from = {
14 | "name": "Shippo Team",
15 | "street1": "965 Mission St",
16 | "street2": "Unit 480",
17 | "city": "San Francisco",
18 | "state": "CA",
19 | "zip": "94103",
20 | "country": "US",
21 | "phone": "+1 555 341 9393",
22 | }
23 |
24 | # Example address_to object dict
25 | # The complete reference for the address object is available here: https://goshippo.com/docs/reference#addresses
26 |
27 | address_to = {
28 | "name": "Shippo Friend",
29 | "street1": "1092 Indian Summer Ct",
30 | "city": "San Jose",
31 | "state": "CA",
32 | "zip": "95122",
33 | "country": "US",
34 | "phone": "+1 555 341 9393",
35 | }
36 |
37 |
38 | # parcel object dict
39 | # The complete reference for parcel object is here: https://goshippo.com/docs/reference#parcels
40 | parcel = {
41 | "length": "5",
42 | "width": "5",
43 | "height": "5",
44 | "distance_unit": "in",
45 | "weight": "2",
46 | "mass_unit": "lb",
47 | }
48 |
49 | # Example shipment object
50 | # For complete reference to the shipment object: https://goshippo.com/docs/reference#shipments
51 | # This object has asynchronous=False, indicating that the function will wait until all rates are generated before it returns.
52 | # By default, Shippo handles responses asynchronously. However this will be depreciated soon. Learn more: https://goshippo.com/docs/async
53 | shipment = shippo.Shipment.create(
54 | address_from=address_from,
55 | address_to=address_to,
56 | parcels=[parcel],
57 | asynchronous=False
58 | )
59 |
60 | # Rates are stored in the `rates` array
61 | # The details on the returned object are here: https://goshippo.com/docs/reference#rates
62 | # Get the first rate in the rates results for demo purposes.
63 | rate = shipment.rates[0]
64 | # Purchase the desired rate with a transaction request
65 | # Set asynchronous=False, indicating that the function will wait until the carrier returns a shipping label before it returns
66 | transaction = shippo.Transaction.create(
67 | rate=rate.object_id, asynchronous=False)
68 |
69 | # print the shipping label from label_url
70 | # Get the tracking number from tracking_number
71 | if transaction.status == "SUCCESS":
72 | print("Purchased label with tracking number %s" %
73 | transaction.tracking_number)
74 | print("The label can be downloaded at %s" % transaction.label_url)
75 | else:
76 | print("Failed purchasing the label due to:")
77 | for message in transaction.messages:
78 | print("- %s" % message['text'])
79 |
80 | # For more tutorals of address validation, tracking, returns, refunds, and other functionality, check out our
81 | # complete documentation: https://goshippo.com/docs/
82 |
--------------------------------------------------------------------------------
/examples/estimate-shipping-prices.py:
--------------------------------------------------------------------------------
1 | import shippo
2 |
3 | """
4 | In this tutorial we want to calculate our average shipping costs so
5 | we set pricing for customers.
6 |
7 | We have a sender address, a parcel and a set of delivery zip codes.
8 | We will retrieve all available shipping rates for each delivery
9 | address and calculate the min, max and average price for specific
10 | transit time windows (next day, 3 days, 7 days).
11 |
12 | Sample output:
13 | For a delivery window of 1 days:
14 | --> Min. costs: 5.81
15 | --> Max. costs: 106.85
16 | --> Avg. costs: 46.91
17 |
18 |
19 | For a delivery window of 3 days:
20 | --> Min. costs: 5.81
21 | --> Max. costs: 106.85
22 | --> Avg. costs: 34.99
23 |
24 |
25 | For a delivery window of 7 days:
26 | --> Min. costs: 3.22
27 | --> Max. costs: 106.85
28 | --> Avg. costs: 29.95
29 |
30 | """
31 |
32 | # Define delivery windows in max. days
33 | # Pick an east coast, a west coast and a mid-west destination
34 | DELIVERY_WINDOWS = [1, 3, 7]
35 | DESTINATION_ADDRESSES_ZIP_CODES = [10007, 60290, 95122]
36 |
37 | # replace with your key
38 | shippo.config.api_key = ""
39 |
40 | # sample address_from
41 | # The complete refence for the address object is available here: https://goshippo.com/docs/reference#addresses
42 | address_from = {
43 | "city": "San Francisco",
44 | "state": "CA",
45 | "zip": "94117",
46 | "country": "US"
47 | }
48 |
49 | # sample address_to placeholder object
50 | # The complete refence for the address object is available here: https://goshippo.com/docs/reference#addresses
51 |
52 | address_to = {
53 | "country": "US"
54 | }
55 |
56 | # Sample parcel, make sure to replace placeholders with your average shipment size
57 | # The complete reference for parcel object is here: https://goshippo.com/docs/reference#parcels
58 |
59 | parcel = {
60 | "length": "5",
61 | "width": "5",
62 | "height": "5",
63 | "distance_unit": "in",
64 | "weight": "2",
65 | "mass_unit": "lb",
66 | }
67 |
68 | """
69 | For each destination address we now create a Shipment object
70 | and store the min, max, average shipping rates per delivery window.
71 | """
72 | shipping_costs = {}
73 |
74 | for delivery_address_zip_code in DESTINATION_ADDRESSES_ZIP_CODES:
75 | # Change delivery address to current delivery address
76 | address_to['zip'] = delivery_address_zip_code
77 | # Creating the shipment object. asynchronous=False indicates that the function will wait until all
78 | # rates are generated before it returns.
79 | # The reference for the shipment object is here: https://goshippo.com/docs/reference#shipments
80 | # By default Shippo API operates on an async basis. You can read about our async flow here: https://goshippo.com/docs/async
81 |
82 | shipment = shippo.Shipment.create(
83 | address_from=address_from,
84 | address_to=address_to,
85 | parcels=[parcel],
86 | asynchronous=False
87 | )
88 | # Rates are stored in the `rates` array
89 | # The details on the returned object are here: https://goshippo.com/docs/reference#rates
90 |
91 | rates = shipment.rates
92 | print("Returned %s rates to %s" % (len(rates), delivery_address_zip_code))
93 | # We now store the shipping cost for each delivery window in our
94 | # `shipping_costs` dictionary to analyse it later.
95 | for delivery_window in DELIVERY_WINDOWS:
96 | # Filter rates that are within delivery window
97 | eligible_rates = (
98 | rate for rate in rates if rate['estimated_days'] <= delivery_window)
99 | new_rate_prices = list(float(rate['amount'])
100 | for rate in eligible_rates if rate['amount'])
101 | existing_rate_prices = shipping_costs[str(delivery_window)] if str(
102 | delivery_window) in shipping_costs else []
103 | shipping_costs[str(delivery_window)
104 | ] = existing_rate_prices + new_rate_prices
105 |
106 | """
107 | Now that we have the costs per delivery window for all sample destination
108 | addresses we can return the min, max and average values.
109 | """
110 | for delivery_window in DELIVERY_WINDOWS:
111 | if not str(delivery_window) in shipping_costs:
112 | print("No rates found for delivery window of %s days" % delivery_window)
113 | else:
114 | costs = shipping_costs[str(delivery_window)]
115 | print("For a delivery window of %s days:" % delivery_window)
116 | print("--> Min. costs: %0.2f" % min(costs))
117 | print("--> Max. costs: %0.2f" % max(costs))
118 | print("--> Avg. costs: %0.2f" % (sum(costs) / float(len(costs))))
119 | print("\n")
120 |
121 | # For more tutorals of address validation, tracking, returns, refunds, and other functionality, check out our
122 | # complete documentation: https://goshippo.com/docs/
123 |
--------------------------------------------------------------------------------
/examples/filter-by-delivery-time.py:
--------------------------------------------------------------------------------
1 | import shippo
2 |
3 | """
4 | In this tutorial we have an order with a sender address,
5 | recipient address and parcel information that we need to ship.
6 |
7 | In addition to that we know that the customer expects the
8 | shipment to arrive within 3 days. We want to purchase
9 | the cheapest shipping label with a transit time <= 3 days.
10 | """
11 |
12 | # for demo purposes we set the max. transit time here
13 | MAX_TRANSIT_TIME_DAYS = 3
14 |
15 | # Replace with your key
16 | shippo.config.api_key = ""
17 |
18 | # Example address_from object dict
19 | # The complete refence for the address object is available here: https://goshippo.com/docs/reference#addresses
20 | address_from = {
21 | "name": "Mrs Hippo",
22 | "street1": "215 Clayton St.",
23 | "city": "San Francisco",
24 | "state": "CA",
25 | "zip": "94117",
26 | "country": "US",
27 | "phone": "+1 555 341 9393",
28 | }
29 |
30 | # Example address_to object dict
31 | # The complete refence for the address object is available here: https://goshippo.com/docs/reference#addresses
32 |
33 | address_to = {
34 | "name": "Mr. Hippo",
35 | "street1": "1092 Indian Summer Ct",
36 | "city": "San Jose",
37 | "state": "CA",
38 | "zip": "95122",
39 | "country": "US",
40 | "phone": "+1 555 341 9393",
41 | }
42 |
43 | # parcel object dict
44 | # The complete reference for parcel object is here: https://goshippo.com/docs/reference#parcels
45 | parcel = {
46 | "length": "5",
47 | "width": "5",
48 | "height": "5",
49 | "distance_unit": "in",
50 | "weight": "2",
51 | "mass_unit": "lb",
52 | }
53 |
54 | # Creating the shipment object. asynchronous=False indicates that the function will wait until all
55 | # rates are generated before it returns.
56 | # The reference for the shipment object is here: https://goshippo.com/docs/reference#shipments
57 | # By default Shippo API operates on an async basis. You can read about our async flow here: https://goshippo.com/docs/async
58 | shipment = shippo.Shipment.create(
59 | address_from=address_from,
60 | address_to=address_to,
61 | parcels=[parcel],
62 | asynchronous=False
63 | )
64 |
65 | # Rates are stored in the `rates` array
66 | # The details on the returned object are here: https://goshippo.com/docs/reference#rates
67 | rates = shipment.rates
68 |
69 | # filter rates by max. transit time, then select cheapest
70 | eligible_rate = (
71 | rate for rate in rates if rate['estimated_days'] <= MAX_TRANSIT_TIME_DAYS)
72 | rate = min(eligible_rate, key=lambda x: float(x['amount']))
73 | print("Picked service %s %s for %s %s with est. transit time of %s days" %
74 | (rate['provider'], rate['servicelevel']['name'], rate['currency'], rate['amount'], rate['estimated_days']))
75 |
76 | # Purchase the desired rate. asynchronous=False indicates that the function will wait until the
77 | # carrier returns a shipping label before it returns
78 | transaction = shippo.Transaction.create(
79 | rate=rate.object_id, asynchronous=False)
80 |
81 | # print label_url and tracking_number
82 | if transaction.status == "SUCCESS":
83 | print("Purchased label with tracking number %s" %
84 | transaction.tracking_number)
85 | print("The label can be downloaded at %s" % transaction.label_url)
86 | else:
87 | print("Failed purchasing the label due to:")
88 | for message in transaction.messages:
89 | print("- %s" % message['text'])
90 |
91 | # For more tutorals of address validation, tracking, returns, refunds, and other functionality, check out our
92 | # complete documentation: https://goshippo.com/docs/
93 |
--------------------------------------------------------------------------------
/examples/get-rates-to-show-customer.py:
--------------------------------------------------------------------------------
1 | import shippo
2 |
3 | """
4 | In this tutorial we have an order with a sender address,
5 | recipient address and parcel. We will retrieve all avail-
6 | able shipping rates, display them to the user and purchase
7 | a label after the user has selected a rate.
8 | """
9 |
10 | # for demo purposes we set the max. transit time here
11 | MAX_TRANSIT_TIME_DAYS = 3
12 |
13 | # replace with your key
14 | shippo.config.api_key = ""
15 |
16 | # Example address_from object dict
17 | # The complete refence for the address object is available here: https://goshippo.com/docs/reference#addresses
18 | address_from = {
19 | "name": "Shippo Team",
20 | "street1": "965 Mission St",
21 | "street2": "Unit 480",
22 | "city": "San Francisco",
23 | "state": "CA",
24 | "zip": "94103",
25 | "country": "US",
26 | "phone": "+1 555 341 9393",
27 | }
28 |
29 | # Example address_to object dict
30 | # The complete refence for the address object is available here: https://goshippo.com/docs/reference#addresses
31 |
32 | address_to = {
33 | "name": "Shippo Friend",
34 | "street1": "1092 Indian Summer Ct",
35 | "city": "San Jose",
36 | "state": "CA",
37 | "zip": "95122",
38 | "country": "US",
39 | "phone": "+1 555 341 9393",
40 | }
41 |
42 | # parcel object dict
43 | # The complete reference for parcel object is here: https://goshippo.com/docs/reference#parcels
44 | parcel = {
45 | "length": "5",
46 | "width": "5",
47 | "height": "5",
48 | "distance_unit": "in",
49 | "weight": "2",
50 | "mass_unit": "lb",
51 | }
52 |
53 | # Example shipment object
54 | # For complete reference to the shipment object: https://goshippo.com/docs/reference#shipments
55 | # This object has asynchronous=False, indicating that the function will wait until all rates are generated before it returns.
56 | # By default, Shippo handles responses asynchronously. However this will be depreciated soon. Learn more: https://goshippo.com/docs/async
57 | shipment = shippo.Shipment.create(
58 | address_from=address_from,
59 | address_to=address_to,
60 | parcels=[parcel],
61 | asynchronous=False
62 | )
63 |
64 | # Rates are stored in the `rates` array
65 | # The details on the returned object are here: https://goshippo.com/docs/reference#rates
66 | rates = shipment.rates
67 |
68 | """
69 | You can now show those rates to the user in your UI.
70 | Most likely you want to show some of the following fields:
71 | - provider (carrier name)
72 | - servicelevel_name
73 | - amount (price of label - you could add e.g. a 10% markup here)
74 | - days (transit time)
75 | Don't forget to store the `object_id` of each Rate so that you
76 | can use it for the label purchase later.
77 | """
78 |
79 | # After the user has selected a rate, use the corresponding object_id
80 | selected_rate_object_id = ''
81 |
82 | # Purchase the desired rate. asynchronous=False indicates that the function will wait until the
83 | # carrier returns a shipping label before it returns
84 | transaction = shippo.Transaction.create(
85 | rate=selected_rate_object_id, asynchronous=False)
86 |
87 | # print the shipping label from label_url
88 | # Get the tracking number from tracking_number
89 | if transaction.status == "SUCCESS":
90 | print("Purchased label with tracking number %s" %
91 | transaction.tracking_number)
92 | print("The label can be downloaded at %s" % transaction.label_url)
93 | else:
94 | print("Failed purchasing the label due to:")
95 | for message in transaction.messages:
96 | print("- %s" % message['text'])
97 |
98 | # For more tutorals of address validation, tracking, returns, refunds, and other functionality, check out our
99 | # complete documentation: https://goshippo.com/docs/
100 |
--------------------------------------------------------------------------------
/examples/international-shipment.py:
--------------------------------------------------------------------------------
1 | import shippo
2 |
3 | """
4 | In this tutorial we have an order with a sender address,
5 | recipient address and parcel. The shipment is going from the
6 | United States to an international location.
7 |
8 | In addition to that we know that the customer expects the
9 | shipment to arrive within 3 days. We now want to purchase
10 | the cheapest shipping label with a transit time <= 3 days.
11 | """
12 |
13 | # replace with your key
14 | shippo.config.api_key = ""
15 |
16 | # Example address_from object dict
17 | # The complete reference for the address object is available here: https://goshippo.com/docs/reference#addresses
18 | address_from = {
19 | "company": "",
20 | "street_no": "",
21 | "name": "Mr. Hippo",
22 | "street1": "215 Clayton St.",
23 | "street2": "",
24 | "city": "San Francisco",
25 | "state": "CA",
26 | "zip": "94117",
27 | "country": "US",
28 | "phone": "+15553419393",
29 | "email": "support@goshippo.com",
30 | }
31 |
32 | # Example address_to object dict
33 | # The complete reference for the address object is available here: https://goshippo.com/docs/reference#addresses
34 |
35 | address_to_international = {
36 | "name": "Mrs. Hippo",
37 | "street1": "200 University Ave W",
38 | "street2": "",
39 | "city": "Waterloo",
40 | "state": "ON",
41 | "zip": "N2L 3G1",
42 | "country": "CA",
43 | "phone": "+1 555 341 9393",
44 | "email": "support@goshippo.com",
45 | "metadata": "For Order Number 123"
46 | }
47 |
48 | # parcel object dict
49 | # The complete reference for parcel object is here: https://goshippo.com/docs/reference#parcels
50 | parcel = {
51 | "length": "5",
52 | "width": "5",
53 | "height": "5",
54 | "distance_unit": "in",
55 | "weight": "2",
56 | "mass_unit": "lb",
57 | }
58 |
59 | # Example CustomsItems object.
60 | # The complete reference for customs object is here: https://goshippo.com/docs/reference#customsitems
61 | customs_item = {
62 | "description": "T-Shirt",
63 | "quantity": 2,
64 | "net_weight": "400",
65 | "mass_unit": "g",
66 | "value_amount": "20",
67 | "value_currency": "USD",
68 | "origin_country": "US",
69 | "tariff_number": "",
70 | }
71 |
72 | # Creating the CustomsDeclaration
73 | # The details on creating the CustomsDeclaration is here: https://goshippo.com/docs/reference#customsdeclarations
74 | customs_declaration = shippo.CustomsDeclaration.create(
75 | contents_type='MERCHANDISE',
76 | contents_explanation='T-Shirt purchase',
77 | non_delivery_option='RETURN',
78 | certify=True,
79 | certify_signer='Mr Hippo',
80 | items=[customs_item])
81 |
82 | # Creating the shipment object. asynchronous=False indicates that the function will wait until all
83 | # rates are generated before it returns.
84 |
85 | # The reference for the shipment object is here: https://goshippo.com/docs/reference#shipments
86 | # By default Shippo API operates on an async basis. You can read about our async flow here: https://goshippo.com/docs/async
87 | shipment_international = shippo.Shipment.create(
88 | address_from=address_from,
89 | address_to=address_to_international,
90 | parcels=[parcel],
91 | customs_declaration=customs_declaration.object_id,
92 | asynchronous=False)
93 |
94 | # Get the first rate in the rates results for demo purposes.
95 | # The details on the returned object are here: https://goshippo.com/docs/reference#rates
96 | rate_international = shipment_international.rates[0]
97 |
98 | # Purchase the desired rate.
99 | # The complete information about purchasing the label: https://goshippo.com/docs/reference#transaction-create
100 | transaction_international = shippo.Transaction.create(
101 | rate=rate_international.object_id, asynchronous=False)
102 |
103 | # print label_url and tracking_number
104 | if transaction_international.status == "SUCCESS":
105 | print("Purchased label with tracking number %s" %
106 | transaction_international.tracking_number)
107 | print("The label can be downloaded at %s" %
108 | transaction_international.label_url)
109 | else:
110 | print("Failed purchasing the label due to:")
111 | for message in transaction_international.messages:
112 | print("- %s" % message['text'])
113 |
114 | # For more tutorials of address validation, tracking, returns, refunds, and other functionality, check out our
115 | # complete documentation: https://goshippo.com/docs/
116 |
--------------------------------------------------------------------------------
/examples/multi_piece_shipment.py:
--------------------------------------------------------------------------------
1 | import shippo
2 | import time
3 |
4 | """
5 | In this example we have a shipment with multiple parcels,
6 | note that not all carriers offer this (most notably USPS).
7 | To ensure that this works as expected try using UPS or FedEx.
8 | Make sure you specify a carrier_account below which is active
9 | and allows for multi-parcel shipments!
10 | """
11 |
12 | # Replace with your key
13 | shippo.config.api_key = ""
14 | # replace with carrier object_id
15 | carrier_account = ""
16 |
17 | # Example address_from object dict
18 | # The complete reference for the address object is available here:
19 | # https://goshippo.com/docs/reference#addresses
20 | address_from = {
21 | "name": "Shippo Team",
22 | "street1": "965 Mission St",
23 | "street2": "Unit 480",
24 | "city": "San Francisco",
25 | "state": "CA",
26 | "zip": "94103",
27 | "country": "US",
28 | "phone": "+1 555 341 9393",
29 | }
30 |
31 | # Example address_to object dict
32 | # The complete fence for the address object is available here:
33 | # https://goshippo.com/docs/reference#addresses
34 |
35 | address_to = {
36 | "name": "Shippo Friend",
37 | "street1": "1092 Indian Summer Ct",
38 | "city": "San Jose",
39 | "state": "CA",
40 | "zip": "95122",
41 | "country": "US",
42 | "phone": "+1 555 341 9393",
43 | }
44 |
45 |
46 | # parcel object dict
47 | # The complete reference for parcel object is here:
48 | # https://goshippo.com/docs/reference#parcels
49 | parcel = {
50 | "length": "3",
51 | "width": "3",
52 | "height": "3",
53 | "distance_unit": "in",
54 | "weight": "1",
55 | "mass_unit": "lb",
56 | }
57 |
58 | # Parcels do not need to be the same!
59 | parcel_list = []
60 | for parcel_piece in range(0,10):
61 | parcel_list.append(parcel)
62 |
63 | print("We now have {} in this shipment!".format(len(parcel_list)))
64 | carrier = [carrier_account]
65 |
66 | # Example shipment object
67 | # For complete reference to the shipment object:
68 | # https://goshippo.com/docs/reference#shipments
69 | shipment = shippo.Shipment.create(
70 | address_from=address_from,
71 | address_to=address_to,
72 | parcels=parcel_list,
73 | carrier_accounts=carrier,
74 | asynchronous=True
75 | )
76 |
77 | # Rates are stored in the `rates` array
78 | # The details on the returned object are here:
79 | # https://goshippo.com/docs/reference#rates
80 | # For demo purposes enter the corresponding enumerated rate and press Enter.
81 | shipment_id = shipment.object_id
82 | print(f"the shipment_id {shipment_id}")
83 | rates = shippo.Shipment.get_rates(shipment.object_id)
84 | print(rates.results)
85 | for x,y in enumerate(rates.results):
86 | print(f"{x}: amount: {y['amount']},rate_object_id {y['object_id']}")
87 | the_rate = int(input("Enter number next to rate"))
88 | rate = rates.results[the_rate]
89 | print("rate selected: \n\n {}".format(rate))
90 |
91 | # Purchase the desired rate with a transaction request
92 | transaction = shippo.Transaction.create(
93 | rate=rate.object_id, label_file_type="PDF_A4",
94 | asynchronous=True)
95 |
96 | # print the shipping label from label_url
97 | # Get the tracking number from tracking_number
98 | if transaction.status == "QUEUED":
99 | print("the_return_response async {}".format(transaction))
100 | #print("Purchased label with tracking number %s" %
101 | # transaction.tracking_number)
102 | #print("The FIRST label can be downloaded at %s" % transaction.label_url)
103 | #
104 |
105 | else:
106 | print("Failed purchasing the label due to:")
107 | for message in transaction.messages:
108 | print("- %s" % message['text'])
109 |
110 | print("This is async so we need to get the transaction + rate_id once queded has changed (to retrieve the remaining labels)")
111 |
112 | RETRY_LIMIT = 60 # retry 60 times before giving up
113 | RETRY_SLEEP = 0.5
114 | tries = 0
115 |
116 | while transaction.status == 'QUEUED' and tries < RETRY_LIMIT:
117 | time.sleep(RETRY_SLEEP)
118 | transaction = shippo.Transaction.retrieve(transaction.object_id)
119 | tries += 1
120 |
121 | if transaction.status == "SUCCESS":
122 | transactions = shippo.Transaction.all(transaction=transaction.object_id,rate=rate.object_id,size=len(parcel_list))
123 | for num,label in enumerate(transactions.results):
124 | print(f"\nPurchased label with tracking number {label.tracking_number}")
125 |
126 | print("Label {} can be downloaded at:\n\n {}".format(num + 1, label.label_url))
127 |
128 | # For more tutorials of address validation, tracking, returns, refunds,
129 | # and other functionality, check out our
130 | # complete documentation: https://goshippo.com/docs/
131 |
--------------------------------------------------------------------------------
/examples/order-lineitem.py:
--------------------------------------------------------------------------------
1 | from datetime import datetime
2 |
3 | import shippo
4 |
5 | """
6 | In this example, we are creating (and consuming) an order object with lineitem(s).
7 | """
8 |
9 | # Replace with your key
10 | shippo.config.api_key = ""
11 |
12 | # Example address_from object dict
13 | # The complete reference for the address object is available here: https://goshippo.com/docs/reference#addresses
14 | address_from = {
15 | "name": "Shippo Team",
16 | "street1": "965 Mission St",
17 | "street2": "Unit 480",
18 | "city": "San Francisco",
19 | "state": "CA",
20 | "zip": "94103",
21 | "country": "US",
22 | "phone": "+1 555 341 9393",
23 | }
24 |
25 | # Example address_to object dict
26 | # The complete reference for the address object is available here: https://goshippo.com/docs/reference#addresses
27 |
28 | address_to = {
29 | "name": "Shippo Friend",
30 | "street1": "1092 Indian Summer Ct",
31 | "city": "San Jose",
32 | "state": "CA",
33 | "zip": "95122",
34 | "country": "US",
35 | "phone": "+1 555 341 9393",
36 | }
37 |
38 | unit_price = 2.34
39 | unit_weight = 25.45
40 | unit_quantity = 2
41 | line_item1 = {
42 | "title": "Demo Line Item Object",
43 | "sku": "demo_1234",
44 | "quantity": unit_quantity,
45 | "total_price": f"{unit_price:.2f}",
46 | "currency": "USD",
47 | "weight": f"{unit_weight:.2f}",
48 | "weight_unit": "lb",
49 | "manufacture_country": "US"
50 | }
51 | line_items = [line_item1]
52 |
53 | shipping_cost = 1.23
54 | subtotal_cost = unit_price
55 | tax_cost = 1.065*subtotal_cost
56 | total_cost = shipping_cost + subtotal_cost + tax_cost
57 | my_order = {
58 | "order_number": f"#{datetime.now().date()}",
59 | "order_status": "PAID",
60 | "to_address": address_to,
61 | "from_address": address_from,
62 | "line_items": line_items,
63 | "placed_at": datetime.now().isoformat(),
64 | "weight": f"{10.0:.2f}",
65 | "weight_unit": "lb",
66 | "shipping_method": "ground",
67 | "shipping_cost": f"{shipping_cost:.2f}",
68 | "shipping_cost_currency": "USD",
69 | "subtotal_price": f"{subtotal_cost:.2f}",
70 | "total_price": f"{total_cost:.2f}",
71 | "total_tax": f"{tax_cost:.2f}",
72 | "currency": "USD"
73 | }
74 |
75 | order = shippo.Order.create(order_number=123,
76 | order_status="PAID",
77 | to_address=address_to,
78 | from_address=address_from,
79 | line_items=[line_item1],
80 | placed_at=datetime.now().isoformat(),
81 | weight=unit_weight*unit_quantity,
82 | weight_unit="lb")
83 | print(order)
84 |
--------------------------------------------------------------------------------
/examples/pickup.py:
--------------------------------------------------------------------------------
1 | import shippo
2 | from datetime import datetime, timedelta
3 |
4 | """
5 | In this tutorial we have an order with a sender address,
6 | recipient address and parcel. The shipment is going from the
7 | United States to an international location.
8 |
9 | In addition to that we know that the customer expects the
10 | shipment to arrive within 3 days. We now want to purchase
11 | the cheapest shipping label with a transit time <= 3 days.
12 | """
13 |
14 | # replace with your key
15 | shippo.config.api_key = ""
16 |
17 | # Example address_from object dict
18 | # The complete reference for the address object is available here: https://goshippo.com/docs/reference#addresses
19 | address_from = {
20 | "company": "",
21 | "street_no": "",
22 | "name": "Shippo Friend",
23 | "street1": "1092 Indian Summer Ct",
24 | "city": "San Jose",
25 | "state": "CA",
26 | "zip": "95122",
27 | "country": "US",
28 | "phone": "+1 555 341 9393",
29 | "email": "support@goshippo.com"
30 | }
31 |
32 | # Example address_to object dict
33 | # The complete reference for the address object is available here: https://goshippo.com/docs/reference#addresses
34 |
35 | address_to_international = {
36 | "name": "Mrs. Hippo",
37 | "street1": "200 University Ave W",
38 | "street2": "",
39 | "city": "Waterloo",
40 | "state": "ON",
41 | "zip": "N2L 3G1",
42 | "country": "CA",
43 | "phone": "+1 555 341 9393",
44 | "email": "support@goshippo.com",
45 | "metadata": "For Order Number 123"
46 | }
47 |
48 | # parcel object dict
49 | # The complete reference for parcel object is here: https://goshippo.com/docs/reference#parcels
50 | parcel = {
51 | "length": "5",
52 | "width": "5",
53 | "height": "5",
54 | "distance_unit": "in",
55 | "weight": "2",
56 | "mass_unit": "lb"
57 | }
58 |
59 | # Example CustomsItems object.
60 | # The complete reference for customs object is here: https://goshippo.com/docs/reference#customsitems
61 | customs_item = {
62 | "description": "T-Shirt",
63 | "quantity": 2,
64 | "net_weight": "400",
65 | "mass_unit": "g",
66 | "value_amount": "20",
67 | "value_currency": "USD",
68 | "origin_country": "US",
69 | "tariff_number": ""
70 | }
71 |
72 | # Creating the CustomsDeclaration
73 | # The details on creating the CustomsDeclaration is here: https://goshippo.com/docs/reference#customsdeclarations
74 | customs_declaration = shippo.CustomsDeclaration.create(
75 | contents_type='MERCHANDISE',
76 | contents_explanation='T-Shirt purchase',
77 | non_delivery_option='RETURN',
78 | certify=True,
79 | certify_signer='Mr Hippo',
80 | items=[customs_item])
81 |
82 | # Creating the shipment object. asynchronous=False indicates that the function will wait until all
83 | # rates are generated before it returns.
84 |
85 | # The reference for the shipment object is here: https://goshippo.com/docs/reference#shipments
86 | # By default Shippo API operates on an async basis. You can read about our async flow here: https://goshippo.com/docs/async
87 | shipment_international = shippo.Shipment.create(
88 | address_from=address_from,
89 | address_to=address_to_international,
90 | parcels=[parcel],
91 | customs_declaration=customs_declaration.object_id,
92 | asynchronous=False)
93 |
94 | # Get the first usps or dhl express rate.
95 | # The details on the returned object are here: https://goshippo.com/docs/reference#rates
96 | filtered_rates = []
97 | for rate in shipment_international.rates:
98 | if rate.provider.lower() == "usps" or rate.provider.lower() == "dhl_express":
99 | filtered_rates.append(rate)
100 | # return strtolower($rate['provider']) == 'usps' Or strtolower($rate['provider']) == 'dhl_express';
101 |
102 | rate_international = filtered_rates[0]
103 | selected_rate_carrier_account = rate_international.carrier_account
104 |
105 | # Purchase the desired rate.
106 | # The complete information about purchasing the label: https://goshippo.com/docs/reference#transaction-create
107 | transaction_international = shippo.Transaction.create(
108 | rate=rate_international.object_id, asynchronous=False)
109 |
110 | if transaction_international.status != "SUCCESS":
111 | print("Failed purchasing the label due to:")
112 | for message in transaction_international.messages:
113 | print("- %s" % message['text'])
114 |
115 | # $pickupTimeStart = date('Y-m-d H:i:s', time());
116 | # $pickupTimeEnd = date('Y-m-d H:i:s', time() + 60*60*24);
117 | pickupTimeStart = datetime.now() + timedelta(hours=1)
118 | pickupTimeEnd = pickupTimeStart + timedelta(days=1)
119 |
120 | # Schedule the pickup
121 | # Only 1 pickup can be scheduled in a day
122 | try:
123 | pickup = shippo.Pickup.create(
124 | carrier_account= selected_rate_carrier_account,
125 | location= {
126 | "building_location_type" : "Knock on Door",
127 | "address" : address_from,
128 | },
129 | transactions= [transaction_international.object_id],
130 | requested_start_time= pickupTimeStart.isoformat() + "Z",
131 | requested_end_time= pickupTimeEnd.isoformat() + "Z",
132 | is_test= False
133 | )
134 | except shippo.error.InvalidRequestError as err:
135 | print("A pickup has already been scheduled for today.")
136 | else:
137 | if pickup.status == "SUCCESS":
138 | print("Pickup has been scheduled")
139 | else:
140 | print("Failed scheduling a pickup:")
141 | for message in pickup.messages:
142 | print("- %s" % message['text'])
143 |
144 | # For more tutorials of address validation, tracking, returns, refunds, and other functionality, check out our
145 | # complete documentation: https://goshippo.com/docs/
146 |
--------------------------------------------------------------------------------
/examples/purchase-fastest-service.py:
--------------------------------------------------------------------------------
1 | import shippo
2 |
3 | """
4 | In this tutorial we have an order with a sender address,
5 | recipient address and parcel information that we need to ship.
6 |
7 | We want to get the cheapest shipping label that will
8 | get the packages to the customer within 3 days.
9 | """
10 |
11 | # for demo purposes we set the max. transit time here
12 | MAX_TRANSIT_TIME_DAYS = 3
13 |
14 | # Replace with your key
15 | shippo.config.api_key = ""
16 |
17 | # Example address_from object dict
18 | # The complete refence for the address object is available here: https://goshippo.com/docs/reference#addresses
19 | address_from = {
20 | "name": "Shippo Team",
21 | "street1": "965 Mission St",
22 | "street2": "Unit 480",
23 | "city": "San Francisco",
24 | "state": "CA",
25 | "zip": "94103",
26 | "country": "US",
27 | "phone": "+1 555 341 9393",
28 | }
29 |
30 | # Example address_to object dict
31 | # The complete refence for the address object is available here: https://goshippo.com/docs/reference#addresses
32 |
33 | address_to = {
34 | "name": "Shippo Friend",
35 | "street1": "1092 Indian Summer Ct",
36 | "city": "San Jose",
37 | "state": "CA",
38 | "zip": "95122",
39 | "country": "US",
40 | "phone": "+1 555 341 9393",
41 | }
42 |
43 |
44 | # parcel object dict
45 | # The complete reference for parcel object is here: https://goshippo.com/docs/reference#parcels
46 | parcel = {
47 | "length": "5",
48 | "width": "5",
49 | "height": "5",
50 | "distance_unit": "in",
51 | "weight": "2",
52 | "mass_unit": "lb",
53 | }
54 |
55 | # Creating the shipment object. asynchronous=False indicates that the function will wait until all
56 | # rates are generated before it returns.
57 | # The reference for the shipment object is here: https://goshippo.com/docs/reference#shipments
58 | # By default Shippo API operates on an async basis. You can read about our async flow here: https://goshippo.com/docs/async
59 | shipment = shippo.Shipment.create(
60 | address_from=address_from,
61 | address_to=address_to,
62 | parcels=[parcel],
63 | asynchronous=False
64 | )
65 |
66 | # Rates are stored in the `rates` array
67 | # The details on the returned object are here: https://goshippo.com/docs/reference#rates
68 | rates = shipment.rates
69 |
70 | # Find the fastest possible transite time
71 | eligible_rates = (
72 | rate for rate in rates if rate['estimated_days'] <= MAX_TRANSIT_TIME_DAYS)
73 | rate = min(eligible_rates, key=lambda x: float(x['amount']))
74 | print("Picked service %s %s for %s %s with est. transit time of %s days" %
75 | (rate['provider'], rate['servicelevel']['name'], rate['currency'], rate['amount'], rate['estimated_days']))
76 |
77 | # Purchase the desired rate. asynchronous=False indicates that the function will wait until the
78 | # carrier returns a shipping label before it returns
79 | transaction = shippo.Transaction.create(
80 | rate=rate.object_id, asynchronous=False)
81 |
82 | # print label_url and tracking_number
83 | if transaction.status == "SUCCESS":
84 | print("Purchased label with tracking number %s" %
85 | transaction.tracking_number)
86 | print("The label can be downloaded at %s" % transaction.label_url)
87 | else:
88 | print("Failed purchasing the label due to:")
89 | for message in transaction.messages:
90 | print("- %s" % message['text'])
91 |
92 | # For more tutorals of address validation, tracking, returns, refunds, and other functionality, check out our
93 | # complete documentation: https://goshippo.com/docs/
94 |
--------------------------------------------------------------------------------
/examples/tracking.py:
--------------------------------------------------------------------------------
1 | import shippo
2 |
3 | '''
4 | In this tutorial we have an order with a sender address,
5 | recipient address and parcel information that we need to ship.
6 | '''
7 |
8 | # Replace with your key
9 | shippo.config.api_key = ""
10 |
11 | # Tracking based on a Shippo transaction
12 | transaction_id = ''
13 | transaction = shippo.Transaction.retrieve(transaction_id)
14 |
15 | if transaction:
16 | print(transaction.get('tracking_status'))
17 | print(transaction.get('tracking_history'))
18 |
19 | # Tracking based on carrier and tracking number
20 | tracking_number = '9205590164917337534322'
21 | # For full list of carrier tokens see https://goshippo.com/docs/reference#carriers
22 | carrier_token = 'usps'
23 | tracking = shippo.Track.get_status(carrier_token, tracking_number)
24 | print(tracking)
25 |
26 | # Create a webhook endpoint (FYI-basic auth not supported)
27 | # For a full list of Webhook Event Types see https://goshippo.com/docs/webhooks/
28 | new_webhook_response = shippo.Webhook.create(url='https://exampledomain.com',event='all')
29 | print(new_webhook_response)
30 |
31 | # list webhook(s)
32 | webhook_list = shippo.Webhook.list_webhooks()
33 | print(webhook_list)
34 |
35 | # remove all webhooks
36 | for webhook in webhook_list['results']:
37 | print("about to delete webhook {}".format(webhook['object_id']))
38 | webhook_remove = shippo.Webhook.delete(object_id=webhook['object_id'])
39 | # print empty 204 status
40 | print(webhook_remove)
41 |
42 |
43 | # Registering a tracking number for webhook
44 | webhook_response = shippo.Track.create(
45 | carrier=carrier_token,
46 | tracking_number=tracking_number,
47 | metadata='optional, up to 100 characters'
48 | )
49 |
50 | print(webhook_response)
51 |
52 | # For more tutorals of address validation, tracking, returns, refunds, and other functionality, check out our
53 | # complete documentation: https://goshippo.com/docs/
54 |
--------------------------------------------------------------------------------
/setup.py:
--------------------------------------------------------------------------------
1 | import os
2 | from setuptools import setup
3 |
4 |
5 | version_contents = {}
6 |
7 | here = os.path.abspath(os.path.dirname(__file__))
8 | with open(os.path.join(here, "shippo", "version.py"), encoding="utf-8") as f:
9 | exec(f.read(), version_contents)
10 |
11 | setup(
12 | name='shippo',
13 | version=version_contents['VERSION'],
14 | description='Shipping API Python library (USPS, FedEx, UPS and more)',
15 | author='Shippo',
16 | author_email='support@goshippo.com',
17 | url='https://goshippo.com/',
18 | packages=['shippo', 'shippo.test', 'shippo.test.integration'],
19 | package_data={'shippo': ['../VERSION']},
20 | install_requires=[
21 | 'chardet',
22 | 'requests',
23 | 'simplejson >= 3.16.0, <= 3.17.2',
24 | ],
25 | test_suite='shippo.test.all',
26 | tests_require=['unittest2', 'mock', 'vcrpy'],
27 | classifiers=[
28 | "Development Status :: 5 - Production/Stable",
29 | "Intended Audience :: Developers",
30 | "License :: OSI Approved :: MIT License",
31 | "Operating System :: OS Independent",
32 | "Programming Language :: Python",
33 | "Programming Language :: Python :: 3.6",
34 | "Programming Language :: Python :: 3.7",
35 | "Programming Language :: Python :: 3.8",
36 | "Programming Language :: Python :: 3.9",
37 | "Programming Language :: Python :: 3 :: Only",
38 | "Programming Language :: Python :: Implementation :: PyPy",
39 | "Topic :: Software Development :: Libraries :: Python Modules",
40 | ]
41 | )
42 |
--------------------------------------------------------------------------------
/shippo/__init__.py:
--------------------------------------------------------------------------------
1 | from shippo.resource import (
2 | Address,
3 | Batch,
4 | CarrierAccount,
5 | CustomsDeclaration,
6 | CustomsItem,
7 | LineItem,
8 | Manifest,
9 | Order,
10 | Parcel,
11 | Pickup,
12 | Rate,
13 | Refund,
14 | Shipment,
15 | Track,
16 | Transaction,
17 | Webhook,
18 | )
19 |
--------------------------------------------------------------------------------
/shippo/certificate_blacklist.py:
--------------------------------------------------------------------------------
1 | import hashlib
2 | from shippo.error import APIError
3 |
4 |
5 | BLACKLISTED_DIGESTS = {
6 | }
7 |
8 |
9 | def verify(hostname, certificate):
10 | """Verifies a PEM encoded certficate against a blacklist of known revoked
11 | fingerprints.
12 |
13 | returns True on success, raises RuntimeError on failure.
14 | """
15 |
16 | if hostname not in BLACKLISTED_DIGESTS:
17 | return True
18 |
19 | sha = hashlib.sha1()
20 | sha.update(certificate)
21 | fingerprint = sha.hexdigest()
22 |
23 | if fingerprint in BLACKLISTED_DIGESTS[hostname]:
24 | raise APIError("Invalid server certificate. You tried to "
25 | "connect to a server that has a revoked "
26 | "SSL certificate, which means we cannot "
27 | "securely send data to that server. "
28 | "Please email support@goshippo.com if you "
29 | "need help connecting to the correct API "
30 | "server.")
31 | return True
32 |
--------------------------------------------------------------------------------
/shippo/config.py:
--------------------------------------------------------------------------------
1 | import os
2 | from typing import Optional
3 |
4 | from shippo.version import VERSION
5 |
6 |
7 | class Configuration:
8 | def __init__(self):
9 | self.sdk_version: str = VERSION
10 | self.api_base: str = os.environ.get('SHIPPO_API_BASE', 'https://api.goshippo.com/')
11 | self.api_key: str = os.environ.get('SHIPPO_API_KEY')
12 | self.api_version: str = os.environ.get('SHIPPO_API_VERSION', '2018-02-08')
13 |
14 | self.app_name: str = os.environ.get('APP_NAME', '')
15 | self.app_version: str = os.environ.get('APP_VERSION', '')
16 |
17 | self.sdk_name = 'ShippoPythonSDK'
18 | self.language = 'Python'
19 |
20 | self.verify_ssl_certs = True
21 | self.timeout_in_seconds: Optional[float] = None
22 | self.rates_req_timeout = float(os.environ.get('RATES_REQ_TIMEOUT', 20.0))
23 |
24 | # SETTINGS BELOW APPLY ONLY TO TESTS
25 |
26 | # Controls how much information is logged to stdout
27 | self.vcr_logging_level = os.environ.get('VCR_LOGGING_LEVEL', 'ERROR')
28 |
29 | # Switch to 'all' for re-recording all cassettes (to be used in CI so that all tests are run without mocks)
30 | self.vcr_record_mode = os.environ.get('VCR_RECORD_MODE', 'once')
31 |
32 |
33 | config = Configuration()
34 |
--------------------------------------------------------------------------------
/shippo/error.py:
--------------------------------------------------------------------------------
1 | # Exceptions
2 | class ShippoError(Exception):
3 |
4 | def __init__(self, message=None, http_body=None, http_status=None,
5 | json_body=None):
6 | super(ShippoError, self).__init__(message)
7 |
8 | if http_body and hasattr(http_body, 'decode'):
9 | try:
10 | http_body = http_body.decode('utf-8')
11 | except:
12 | http_body = ('')
14 |
15 | self.http_body = http_body
16 |
17 | self.http_status = http_status
18 | self.json_body = json_body
19 |
20 |
21 | class APIError(ShippoError):
22 | pass
23 |
24 |
25 | class APIConnectionError(ShippoError):
26 | pass
27 |
28 |
29 | class ConfigurationError(ShippoError):
30 | pass
31 |
32 |
33 | class AddressError(ShippoError):
34 |
35 | def __init__(self, message, param, code, http_body=None,
36 | http_status=None, json_body=None):
37 | super(AddressError, self).__init__(
38 | message, http_body, http_status, json_body)
39 | self.param = param
40 | self.code = code
41 |
42 |
43 | class InvalidRequestError(ShippoError):
44 |
45 | def __init__(self, message, param, http_body=None,
46 | http_status=None, json_body=None):
47 | super(InvalidRequestError, self).__init__(
48 | message, http_body, http_status, json_body)
49 | self.param = param
50 |
51 |
52 | class AuthenticationError(ShippoError):
53 | pass
54 |
--------------------------------------------------------------------------------
/shippo/test/__init__.py:
--------------------------------------------------------------------------------
1 | import os
2 | import unittest2
3 |
4 |
5 | def all():
6 | path = os.path.dirname(os.path.realpath(__file__))
7 | return unittest2.defaultTestLoader.discover(path)
8 |
9 |
10 | def integration():
11 | path = os.path.dirname(os.path.realpath(__file__))
12 | return unittest2.defaultTestLoader.discover(
13 | os.path.join(path, "integration")
14 | )
15 |
--------------------------------------------------------------------------------
/shippo/test/fixtures/address/test_create:
--------------------------------------------------------------------------------
1 | interactions:
2 | - request:
3 | body: !!python/unicode '{"city": "San Francisco", "name": "Laura Behrens Wu",
4 | "zip": "94117", "street1": "Clayton St.", "company": "Shippo", "street_no":
5 | "215", "phone": "+1 555 341 9393", "state": "CA", "country": "US", "street2":
6 | "", "metadata": "Customer ID 123456"}'
7 | headers:
8 | Accept: ['*/*']
9 | Accept-Encoding: ['gzip, deflate']
10 | Connection: [keep-alive]
11 | Content-Length: ['245']
12 | Content-Type: [application/json]
13 | Shippo-API-Version: ['2017-03-29']
14 | User-Agent: [Shippo/v1 PythonBindings/1.4.0]
15 | X-Shippo-Client-User-Agent: ['{"lang": "python", "publisher": "shippo", "httplib":
16 | "requests", "uname": "Darwin guozhen-shippo-mbp.local 16.4.0 Darwin Kernel
17 | Version 16.4.0: Thu Dec 22 22:53:21 PST 2016; root:xnu-3789.41.3~3/RELEASE_X86_64
18 | x86_64 i386", "lang_version": "2.7.10", "platform": "Darwin-16.4.0-x86_64-i386-64bit",
19 | "bindings_version": "1.4.0"}']
20 | method: POST
21 | uri: https://api.goshippo.com/addresses/
22 | response:
23 | body:
24 | string: !!binary |
25 | H4sIANjy61gC/31QW0vDMBT+K6HPbiRts657UieC4NsUwZdylh7XSJuUXJRt7L+b0zmGLz6e75p8
26 | x8xuP1GFRjmEgG22YlnORTXj5Uzwl1yseL4Si7mo5Xt2wy7qOLb/qXP+R60nIbRLjpX8EHUB5bLd
27 | LhWUVaVKkctqIStBBu0bZYexx4DJElzEBH5Br1OdtqZx6GMffOKOp2u+/TboqGIX7aFDc7uzvtPj
28 | aOcpjGINDJSXPUN0wO6xc2g8e4vEUR+YPdGbyUSgDw4xNMZOPxTyiglC1j3sgzVsE+ZXJifmehaX
29 | U+lwTgfDHh0Ypb36LYHpm9n6js6DHumoSyGq88OiCW6yvm4IGDtrJj3nQkpZlGnJuiAGB9D9pS9t
30 | mGbSLZqggVAT+z7hAwZIM8LUGH2wAzr29MBEXpRyQc6APvzOfvoBGU5bhRkCAAA=
31 | headers:
32 | allow: [OPTIONS]
33 | connection: [keep-alive]
34 | content-encoding: [gzip]
35 | content-length: ['332']
36 | content-type: [application/json]
37 | date: ['Mon, 10 Apr 2017 21:02:16 GMT']
38 | p3p: [CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"]
39 | server: [nginx/1.8.0]
40 | vary: ['Host, Cookie, Accept-Encoding']
41 | status: {code: 201, message: CREATED}
42 | version: 1
43 |
--------------------------------------------------------------------------------
/shippo/test/fixtures/address/test_invalid_create:
--------------------------------------------------------------------------------
1 | interactions:
2 | - request:
3 | body: !!python/unicode '{"city": "San Francisco", "name": "Laura Behrens Wu",
4 | "country": "US", "company": "Shippo", "phone": "+1 555 341 9393", "state": "CA",
5 | "street2": "", "metadata": "Customer ID 123456"}'
6 | headers:
7 | Accept: ['*/*']
8 | Accept-Encoding: ['gzip, deflate']
9 | Connection: [keep-alive]
10 | Content-Length: ['183']
11 | Content-Type: [application/json]
12 | Shippo-API-Version: ['2017-03-29']
13 | User-Agent: [Shippo/v1 PythonBindings/1.4.0]
14 | X-Shippo-Client-User-Agent: ['{"lang": "python", "publisher": "shippo", "httplib":
15 | "requests", "uname": "Darwin guozhen-shippo-mbp.local 16.4.0 Darwin Kernel
16 | Version 16.4.0: Thu Dec 22 22:53:21 PST 2016; root:xnu-3789.41.3~3/RELEASE_X86_64
17 | x86_64 i386", "lang_version": "2.7.10", "platform": "Darwin-16.4.0-x86_64-i386-64bit",
18 | "bindings_version": "1.4.0"}']
19 | method: POST
20 | uri: https://api.goshippo.com/addresses/
21 | response:
22 | body:
23 | string: !!binary |
24 | H4sIANjy61gC/31QyU7DMBD9FStnWtlxFtITm5CQuBWExCWaJpPGyLEjLyBa9d+xDaX0wnHeqnn7
25 | TG/esHNtZxAc9tmKZDll9YIWC0afcrai+YpVy0tWvWYX5Kj2c/+vOm/+qkUSAq05K4ehGHpeVBvc
26 | sMuhx66qh7opWVVFg7Btp6dZosNgGUBaDOg7SBH6hFatQeuls4HcH04F+kOhiR1br3cjqquttqOY
27 | Z70MaTFXwRQDs0fwBsgNjgaVJS8+crEQ1Gek18kUQesMomuVjvAJYOdnfn7y49kJ950HitwbUJ2w
28 | 3U8spM+y2+t47sT8a9FeOZNcz+sIzKNWSUopK8uSF6zhDY8MTiDk0RcWC5uIHpUTEFHlpQz4hA7C
29 | ZpDKvHV6QkMe7gjLeVGmrR1aF1hnPB6+ADnTjNYHAgAA
30 | headers:
31 | allow: [OPTIONS]
32 | connection: [keep-alive]
33 | content-encoding: [gzip]
34 | content-length: ['318']
35 | content-type: [application/json]
36 | date: ['Mon, 10 Apr 2017 21:02:16 GMT']
37 | p3p: [CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"]
38 | server: [nginx/1.8.0]
39 | vary: ['Host, Cookie, Accept-Encoding']
40 | status: {code: 201, message: CREATED}
41 | version: 1
42 |
--------------------------------------------------------------------------------
/shippo/test/fixtures/address/test_invalid_retrieve:
--------------------------------------------------------------------------------
1 | interactions:
2 | - request:
3 | body: null
4 | headers:
5 | Accept: ['*/*']
6 | Accept-Encoding: ['gzip, deflate']
7 | Connection: [keep-alive]
8 | Content-Type: [application/json]
9 | Shippo-API-Version: ['2017-03-29']
10 | User-Agent: [Shippo/v1 PythonBindings/1.4.0]
11 | X-Shippo-Client-User-Agent: ['{"lang": "python", "publisher": "shippo", "httplib":
12 | "requests", "uname": "Darwin guozhen-shippo-mbp.local 16.4.0 Darwin Kernel
13 | Version 16.4.0: Thu Dec 22 22:53:21 PST 2016; root:xnu-3789.41.3~3/RELEASE_X86_64
14 | x86_64 i386", "lang_version": "2.7.10", "platform": "Darwin-16.4.0-x86_64-i386-64bit",
15 | "bindings_version": "1.4.0"}']
16 | method: GET
17 | uri: https://api.goshippo.com/addresses/EXAMPLE_OF_INVALID_ID
18 | response:
19 | body:
20 | string: !!binary |
21 | H4sIAAAAAAAAAxXMQQqDMBAF0Kv8E3RwHwKCCoHUimjpLgiZkm4SzUS9vnb5Nk+FSvepoEt79Ipu
22 | qVVPgZF521kKe8yjBR0VLd5nFmGh9lM/B9u6V+dM/66taZxpcC6CeFfff4UUUcJPIJwPzg9Fq74A
23 | kv+RJ2wAAAA=
24 | headers:
25 | connection: [keep-alive]
26 | content-encoding: [gzip]
27 | content-length: ['122']
28 | content-type: [text/html]
29 | date: ['Mon, 10 Apr 2017 21:02:17 GMT']
30 | p3p: [CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"]
31 | server: [nginx/1.8.0]
32 | vary: ['Host, Cookie']
33 | status: {code: 404, message: NOT FOUND}
34 | version: 1
35 |
--------------------------------------------------------------------------------
/shippo/test/fixtures/address/test_invalid_validate:
--------------------------------------------------------------------------------
1 | interactions:
2 | - request:
3 | body: !!python/unicode '{"city": "San Francisco", "name": "Laura Behrens Wu",
4 | "zip": "74338", "street1": "ClaytonKLJLKJL St.", "company": "Shippo", "street_no":
5 | "0798987987987", "phone": "+1 555 341 9393", "state": "CA", "country": "US",
6 | "street2": "", "metadata": "Customer ID 123456"}'
7 | headers:
8 | Accept: ['*/*']
9 | Accept-Encoding: ['gzip, deflate']
10 | Connection: [keep-alive]
11 | Content-Length: ['262']
12 | Content-Type: [application/json]
13 | Shippo-API-Version: ['2017-03-29']
14 | User-Agent: [Shippo/v1 PythonBindings/1.4.0]
15 | X-Shippo-Client-User-Agent: ['{"lang": "python", "publisher": "shippo", "httplib":
16 | "requests", "uname": "Darwin guozhen-shippo-mbp.local 16.4.0 Darwin Kernel
17 | Version 16.4.0: Thu Dec 22 22:53:21 PST 2016; root:xnu-3789.41.3~3/RELEASE_X86_64
18 | x86_64 i386", "lang_version": "2.7.10", "platform": "Darwin-16.4.0-x86_64-i386-64bit",
19 | "bindings_version": "1.4.0"}']
20 | method: POST
21 | uri: https://api.goshippo.com/addresses/
22 | response:
23 | body:
24 | string: !!binary |
25 | H4sIANry61gC/31RW0/CMBT+K8uehbTrZjeeVIyJsDc0Jr4sZTuwmq1detEA4b/bMyDzyaQv3+18
26 | 7ekp1tsvqF1VGxAOmngRxQmhfEbSGSVvCV2QZEHzOWHFZ3wX3dx+aP51c/bXLUcjhR3L6K4hNc9T
27 | YIlIM8b5luwE5QkkHAPSVrXuhw4chIgzHgL5LToZ6qRWlQHrO2eDdjpP8/WPAoMVe6+PLaiHvbat
28 | HAY9D8NwrBI9zotL4Y2InqA1oGz04VHDPqEOKG/GEJLWGQBXKY004UVe5PxyJpWituzEwWm1Llfl
29 | elVGGzefDAkaJshusJbuUidU9GKEqqWtr61ifHe8fER4lAMCnjKWX27qlTNj9H2DxNBqNfoJoVmW
30 | sZQWrGCoQC9kd+sLSw17kw0oJwWyyndd4HtwIuxVjI3eOt2DiV6fI5qwNLvHpAPrrv9w/gX3HFdr
31 | KgIAAA==
32 | headers:
33 | allow: [OPTIONS]
34 | connection: [keep-alive]
35 | content-encoding: [gzip]
36 | content-length: ['346']
37 | content-type: [application/json]
38 | date: ['Mon, 10 Apr 2017 21:02:18 GMT']
39 | p3p: [CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"]
40 | server: [nginx/1.8.0]
41 | vary: ['Host, Cookie, Accept-Encoding']
42 | status: {code: 201, message: CREATED}
43 | - request:
44 | body: null
45 | headers:
46 | Accept: ['*/*']
47 | Accept-Encoding: ['gzip, deflate']
48 | Connection: [keep-alive]
49 | Content-Type: [application/json]
50 | Shippo-API-Version: ['2017-03-29']
51 | User-Agent: [Shippo/v1 PythonBindings/1.4.0]
52 | X-Shippo-Client-User-Agent: ['{"lang": "python", "publisher": "shippo", "httplib":
53 | "requests", "uname": "Darwin guozhen-shippo-mbp.local 16.4.0 Darwin Kernel
54 | Version 16.4.0: Thu Dec 22 22:53:21 PST 2016; root:xnu-3789.41.3~3/RELEASE_X86_64
55 | x86_64 i386", "lang_version": "2.7.10", "platform": "Darwin-16.4.0-x86_64-i386-64bit",
56 | "bindings_version": "1.4.0"}']
57 | method: GET
58 | uri: https://api.goshippo.com/addresses/1ef351fd0c784e32a45377b0fa172e27/validate
59 | response:
60 | body:
61 | string: !!binary |
62 | H4sIANvy61gC/3VSW2/TMBT+K0d5ZlGctEvcJ0rRpG1VN9EiBAhVTnLaGBI78qVsq/rf8UlWCkJI
63 | fjnf5dx8jpEuv2PltpVB4bCOZhClCcuvkskVSzYpmyXpjBUxL5Iv0Rs4q31f/1/N45z9pZajkKc1
64 | K4tC1BWbTK8FL/mE51meltPrXcZLMki7rXTXt+gwWHaitRjQg2hlqCe12hq0vnU2kEcSD8wfyg6t
65 | FXsk/usxstqbihJFH9ePa8pf6XqI53UdMllYaQc32quaSIdPjshNgyBeBcKC9WUnXZgWKu3bGlTw
66 | lAg7ssXw2KKwCFWD1Y+AGcCnKhjlIeQoS4MHOTRuQSpwIbF1BtH9zt9KhRBcr+xCumdQosM4On07
67 | XTaofyo01Nve65cG1du9to3sex2HdVHv5CF+KbwR8A4bg6HmJz8O3fVCPRO9HkwEjn1slSY4yXnB
68 | i3x8F5b9w8FiOf+8eVjdL++W93dLWG/iizwl+SXMzmEVhhqKz1dw82G+WtyuFw+jTgz/HC3mFL7I
69 | noJ8kmXF2LdXzjyP/0dA32g16JOETafTbMJ4xjNisBOyPdcLdxF2K2tUTgpClW/b4TicCGckhore
70 | Ot2hgdv3wNIs3ON4AZYuwBmPp1/oaYWJGgMAAA==
71 | headers:
72 | allow: [OPTIONS]
73 | connection: [keep-alive]
74 | content-encoding: [gzip]
75 | content-length: ['484']
76 | content-type: [application/json]
77 | date: ['Mon, 10 Apr 2017 21:02:19 GMT']
78 | p3p: [CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"]
79 | server: [nginx/1.8.0]
80 | vary: ['Host, Cookie, Accept-Encoding']
81 | status: {code: 200, message: OK}
82 | version: 1
83 |
--------------------------------------------------------------------------------
/shippo/test/fixtures/address/test_list_all:
--------------------------------------------------------------------------------
1 | interactions:
2 | - request:
3 | body: null
4 | headers:
5 | Accept: ['*/*']
6 | Accept-Encoding: ['gzip, deflate']
7 | Connection: [keep-alive]
8 | Content-Type: [application/json]
9 | Shippo-API-Version: ['2017-03-29']
10 | User-Agent: [Shippo/v1 PythonBindings/1.4.0]
11 | X-Shippo-Client-User-Agent: ['{"lang": "python", "publisher": "shippo", "httplib":
12 | "requests", "uname": "Darwin guozhen-shippo-mbp.local 16.4.0 Darwin Kernel
13 | Version 16.4.0: Thu Dec 22 22:53:21 PST 2016; root:xnu-3789.41.3~3/RELEASE_X86_64
14 | x86_64 i386", "lang_version": "2.7.10", "platform": "Darwin-16.4.0-x86_64-i386-64bit",
15 | "bindings_version": "1.4.0"}']
16 | method: GET
17 | uri: https://api.goshippo.com/addresses/
18 | response:
19 | body:
20 | string: !!binary |
21 | H4sIANzy61gC/92WbWvcOBDHv4rw68ZrPVlyoPT29gi0XdLSTSl3pQRZHmd19VrGktOmId+9kr3J
22 | pkkLWciV9sBvZuY/0sz4J6HLRNuh9ckhohjzJyhp4XO0krX3nTuczVRn0jPr1qbrbKrtZnaOZ6qq
23 | enAO3OxZp87gKUlCYtfDubGDC8nt0DTBEzRD46Pj/WViy39B+1Pdg/JQxR1IhsVBxg5wdkLwYUYO
24 | sUwLmf0TF9uqh676sbpIBf5GbSZhQSpcSqkqjRnPVVEWrBBUkJLnNS3KmGDcaWila8BDSKlV4yB4
25 | z1Vjwn7Gtqe70i+jeIzcUm5C96HxbWvODr2OCyVvV69XcX1tq9GeT4NCx9ajozDnKgb9dsIna0Db
26 | SSLlkBvKjfGhWxT+SFOhNuSUgOqYlqLXDSgHSK9Bfwy+HsFnHRLNeVijLOPox8IdMi3yYWHnewB/
27 | s35jWkAhaxtdGH+BWrWBNLn6cLWboP3UQh9rOxvslzW0f9z+87H2mBPjSzX0Cv0J6x7Cnu+GqelN
28 | p9qLGF6NSdE51XHa2ujORCELKaZvF8X3YmixnP998ur45fLF8uWLJVqdpDs5ifKdSa9NHZoaN58f
29 | o6M38+PF89Xi1aRT439OFvNofjFdNASjVE51hwPQX0z/byR5bdtRn2WYc04ZLmhBYwQ2yjTX+wUu
30 | wmxNBa03qtlhvwGvAkZq3HFw3m6gR8//QpjQwONEgIsE+H6AMPyHno2MFvucjYzdPxsYaspxXWVa
31 | SAaUKMapEGVWKywIEHH/bMQaf3g0fg1yFo268La9YcXvw4pq0VGvWm2ctv8bVvJU4vzBrAQ1Ke6z
32 | ojJBMa9rVleU5SWUWNYV6FzUouA4z/e9R38eLHf4eHQaficQcMH3AIFk/DsgVDIDwevQkGKyKqVW
33 | TAjNMOEi5wL/spcGwfz7V8V/ckcUDGPx+6DBUibJg9HgafbtjTKhAXlgoKyZkIEHymopZGhRE64q
34 | Jngu90Tj9lNrK7z90vqJL5U73ASSrp8k4S3y6E+REZ0DXGD6qPzcjHDHz11aPlx9BfV7k0oBDAAA
35 | headers:
36 | allow: [OPTIONS]
37 | connection: [keep-alive]
38 | content-encoding: [gzip]
39 | content-length: ['798']
40 | content-type: [application/json]
41 | date: ['Mon, 10 Apr 2017 21:02:20 GMT']
42 | p3p: [CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"]
43 | server: [nginx/1.8.0]
44 | vary: ['Host, Cookie, Accept-Encoding']
45 | status: {code: 200, message: OK}
46 | version: 1
47 |
--------------------------------------------------------------------------------
/shippo/test/fixtures/address/test_list_page_size:
--------------------------------------------------------------------------------
1 | interactions:
2 | - request:
3 | body: null
4 | headers:
5 | Accept: ['*/*']
6 | Accept-Encoding: ['gzip, deflate']
7 | Connection: [keep-alive]
8 | Content-Type: [application/json]
9 | Shippo-API-Version: ['2017-03-29']
10 | User-Agent: [Shippo/v1 PythonBindings/1.4.0]
11 | X-Shippo-Client-User-Agent: ['{"lang": "python", "publisher": "shippo", "httplib":
12 | "requests", "uname": "Darwin guozhen-shippo-mbp.local 16.4.0 Darwin Kernel
13 | Version 16.4.0: Thu Dec 22 22:53:21 PST 2016; root:xnu-3789.41.3~3/RELEASE_X86_64
14 | x86_64 i386", "lang_version": "2.7.10", "platform": "Darwin-16.4.0-x86_64-i386-64bit",
15 | "bindings_version": "1.4.0"}']
16 | method: GET
17 | uri: https://api.goshippo.com/addresses/?results=1
18 | response:
19 | body:
20 | string: !!binary |
21 | H4sIAN3y61gC/3VT22rbQBD9lUUPfWpkrWRFkiG0rksgiXFC7RDaUsxKGlvbSrtiL04ck3/vrKRU
22 | KaVgEDPnnLmcHZ+8QlphvBmJKI3fE0/Ak4u8yphWzyYT1nJ/L3XF21b6hWwmBzphZalAa9CTD/i1
23 | tdEX9F3L9nAReliiVXDg0mosI2xdY2ZgYeL7yZP5TyjMtlDADJSuVxjQ5CyYntFgE9JZEM5o6mdp
24 | 8M0VG9i2Lf/PzvyE/sXmPTELS5qnKSsLOo3PWZZn0yyJkjCPz3dRljsB11tcqq3BAEp2rNaA2QOr
25 | OfbjUmzH0U+O3CFvmA36gIsPq2lpVeEKeffru7WrX8iyi+e9ZWQlDblEx0sHmsHrTQVk8JQwTbTN
26 | G25wW4JvU5dEoCYHsnMyn9zVwDSQooLiF+YUgacChfyANfLcWd8NrgkXxGBhbRSA+VO/5gIIqgZ0
27 | wc2RCNaA7738eBkdlI8ClJttb+VzBeLj2xtwszuNw5fMKkY+QaUAez7YfummZeLo4HUncsl+jq2Q
28 | Lh0kWZqlSf8bUfoPRhbL+dfN7epmeb28uV6S9cYf6aGjj2H0Gha4VNd8viKXX+arxdV6cdvzWPfO
29 | 3mLuwmfeuiCZRlHaz41/BXXs36+75EqKjh8ENI7jaEqzKIscAg3j9Ws/vAv0lpcgDGf1ePYNGIZn
30 | xLqOVhvZgCJXnwkNI7zH/gK0uwCjLKD9vwGnKJDtjQMAAA==
31 | headers:
32 | allow: [OPTIONS]
33 | connection: [keep-alive]
34 | content-encoding: [gzip]
35 | content-length: ['547']
36 | content-type: [application/json]
37 | date: ['Mon, 10 Apr 2017 21:02:21 GMT']
38 | p3p: [CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"]
39 | server: [nginx/1.8.0]
40 | vary: ['Host, Cookie, Accept-Encoding']
41 | status: {code: 200, message: OK}
42 | version: 1
43 |
--------------------------------------------------------------------------------
/shippo/test/fixtures/address/test_retrieve:
--------------------------------------------------------------------------------
1 | interactions:
2 | - request:
3 | body: !!python/unicode '{"city": "San Francisco", "name": "Laura Behrens Wu",
4 | "zip": "94117", "street1": "Clayton St.", "company": "Shippo", "street_no":
5 | "215", "phone": "+1 555 341 9393", "state": "CA", "country": "US", "street2":
6 | "", "metadata": "Customer ID 123456"}'
7 | headers:
8 | Accept: ['*/*']
9 | Accept-Encoding: ['gzip, deflate']
10 | Connection: [keep-alive]
11 | Content-Length: ['245']
12 | Content-Type: [application/json]
13 | Shippo-API-Version: ['2017-03-29']
14 | User-Agent: [Shippo/v1 PythonBindings/1.4.0]
15 | X-Shippo-Client-User-Agent: ['{"lang": "python", "publisher": "shippo", "httplib":
16 | "requests", "uname": "Darwin guozhen-shippo-mbp.local 16.4.0 Darwin Kernel
17 | Version 16.4.0: Thu Dec 22 22:53:21 PST 2016; root:xnu-3789.41.3~3/RELEASE_X86_64
18 | x86_64 i386", "lang_version": "2.7.10", "platform": "Darwin-16.4.0-x86_64-i386-64bit",
19 | "bindings_version": "1.4.0"}']
20 | method: POST
21 | uri: https://api.goshippo.com/addresses/
22 | response:
23 | body:
24 | string: !!binary |
25 | H4sIAN3y61gC/31QT0vDMBT/KqVnN5Kmaded1IkgeJsieClZ+1wjbVKSF2Ub++7mdY568vj7n7xT
26 | anef0GDdOFAIbbpO0ozxcsHyBWcvGV+zbJ3xZVHx9/QmubrD2P7nLhn769aTcSdl9ZG3oFYl5EIW
27 | K8kqtpLVqmWFyEVLAe3rxg5jDwgxgi5AJL9Ur+OctqZ24EOPPmqn89xvvw04mtgHe+zA3O6t7/Q4
28 | 2mUso1qjBupLn1VwKrmHzoHxyVsgjfaUOZC8nUJEenQAWBs7/ZDLmePEbHp1QGuSLS5nJSNlhuIK
29 | G42XdmWSR6dMo33zO6Kmb6abO4JHPRKocs7Ly8OCQTdFX7dEjJ01k58xLqUUOa9EJUiBQen+uhdv
30 | GM+kWzCoFbEm9H3kB0AVz6imxeDRDuCSp4eEZyKXBSURPP6e/fwDgU4AvBkCAAA=
31 | headers:
32 | allow: [OPTIONS]
33 | connection: [keep-alive]
34 | content-encoding: [gzip]
35 | content-length: ['332']
36 | content-type: [application/json]
37 | date: ['Mon, 10 Apr 2017 21:02:21 GMT']
38 | p3p: [CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"]
39 | server: [nginx/1.8.0]
40 | vary: ['Host, Cookie, Accept-Encoding']
41 | status: {code: 201, message: CREATED}
42 | - request:
43 | body: null
44 | headers:
45 | Accept: ['*/*']
46 | Accept-Encoding: ['gzip, deflate']
47 | Connection: [keep-alive]
48 | Content-Type: [application/json]
49 | Shippo-API-Version: ['2017-03-29']
50 | User-Agent: [Shippo/v1 PythonBindings/1.4.0]
51 | X-Shippo-Client-User-Agent: ['{"lang": "python", "publisher": "shippo", "httplib":
52 | "requests", "uname": "Darwin guozhen-shippo-mbp.local 16.4.0 Darwin Kernel
53 | Version 16.4.0: Thu Dec 22 22:53:21 PST 2016; root:xnu-3789.41.3~3/RELEASE_X86_64
54 | x86_64 i386", "lang_version": "2.7.10", "platform": "Darwin-16.4.0-x86_64-i386-64bit",
55 | "bindings_version": "1.4.0"}']
56 | method: GET
57 | uri: https://api.goshippo.com/addresses/b559f4dea87e4356850908598d06343d
58 | response:
59 | body:
60 | string: !!binary |
61 | H4sIAN7y61gC/31QT0vDMBT/KqVnN5Kmaded1IkgeJsieClZ+1wjbVKSF2Ub++7mdY568vj7n7xT
62 | anef0GDdOFAIbbpO0ozxcsHyBWcvGV+zbJ3xZVHx9/QmubrD2P7nLhn769aTcSdl9ZG3oFYl5EIW
63 | K8kqtpLVqmWFyEVLAe3rxg5jDwgxgi5AJL9Ur+OctqZ24EOPPmqn89xvvw04mtgHe+zA3O6t7/Q4
64 | 2mUso1qjBupLn1VwKrmHzoHxyVsgjfaUOZC8nUJEenQAWBs7/ZDLmePEbHp1QGuSLS5nJSNlhuIK
65 | G42XdmWSR6dMo33zO6Kmb6abO4JHPRKocs7Ly8OCQTdFX7dEjJ01k58xLqUUOa9EJUiBQen+uhdv
66 | GM+kWzCoFbEm9H3kB0AVz6imxeDRDuCSp4eEZyKXBSURPP6e/fwDgU4AvBkCAAA=
67 | headers:
68 | allow: [OPTIONS]
69 | connection: [keep-alive]
70 | content-encoding: [gzip]
71 | content-length: ['332']
72 | content-type: [application/json]
73 | date: ['Mon, 10 Apr 2017 21:02:22 GMT']
74 | p3p: [CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"]
75 | server: [nginx/1.8.0]
76 | vary: ['Host, Cookie, Accept-Encoding']
77 | status: {code: 200, message: OK}
78 | version: 1
79 |
--------------------------------------------------------------------------------
/shippo/test/fixtures/address/test_validate:
--------------------------------------------------------------------------------
1 | interactions:
2 | - request:
3 | body: !!python/unicode '{"city": "San Francisco", "name": "Laura Behrens Wu",
4 | "zip": "94117", "street1": "Clayton St.", "company": "Shippo", "street_no":
5 | "215", "phone": "+1 555 341 9393", "state": "CA", "country": "US", "street2":
6 | "", "metadata": "Customer ID 123456"}'
7 | headers:
8 | Accept: ['*/*']
9 | Accept-Encoding: ['gzip, deflate']
10 | Connection: [keep-alive]
11 | Content-Length: ['245']
12 | Content-Type: [application/json]
13 | Shippo-API-Version: ['2017-03-29']
14 | User-Agent: [Shippo/v1 PythonBindings/1.4.0]
15 | X-Shippo-Client-User-Agent: ['{"lang": "python", "publisher": "shippo", "httplib":
16 | "requests", "uname": "Darwin guozhen-shippo-mbp.local 16.4.0 Darwin Kernel
17 | Version 16.4.0: Thu Dec 22 22:53:21 PST 2016; root:xnu-3789.41.3~3/RELEASE_X86_64
18 | x86_64 i386", "lang_version": "2.7.10", "platform": "Darwin-16.4.0-x86_64-i386-64bit",
19 | "bindings_version": "1.4.0"}']
20 | method: POST
21 | uri: https://api.goshippo.com/addresses/
22 | response:
23 | body:
24 | string: !!binary |
25 | H4sIAN7y61gC/31QW0/CMBT+K82ehfSyDsaTijEx8Q2NiS/LYTuwmq1detEA4b/bDsh88vG7t+eU
26 | me0X1r6qLYLHJluRjFO2mNF8xugbZyvKV5zPS778zO7IzR2G5l+3kH/dajQik3QnuICiKfJc8pLv
27 | FguQBQBd8u1ylwLKVbXphw49xoi3ASP5DZ2Kc8royqILnXdRO52nfvOj0aaJfTDHFvX93rhWDYOZ
28 | x7JUq6FPfdkrBAvkEVuL2pGPkLS0B/qQ5M0YSqTzFtFX2ow/ZHLiWGLWHRy80WTj55PCkzJBcYO1
29 | 8pd20OTZgq6Vq68jMH4zWz8keFRDAmXO2OLysKC9HaPvm0QMrdGjn1ImpRQ5K0UpkoI9qO62F28Y
30 | z6Qa1F5BYnXousj36CGeEcbF4Lzp0ZKXJ8K4yGWRkh6dv579/Au3wdTWGQIAAA==
31 | headers:
32 | allow: [OPTIONS]
33 | connection: [keep-alive]
34 | content-encoding: [gzip]
35 | content-length: ['331']
36 | content-type: [application/json]
37 | date: ['Mon, 10 Apr 2017 21:02:22 GMT']
38 | p3p: [CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"]
39 | server: [nginx/1.8.0]
40 | vary: ['Host, Cookie, Accept-Encoding']
41 | status: {code: 201, message: CREATED}
42 | - request:
43 | body: null
44 | headers:
45 | Accept: ['*/*']
46 | Accept-Encoding: ['gzip, deflate']
47 | Connection: [keep-alive]
48 | Content-Type: [application/json]
49 | Shippo-API-Version: ['2017-03-29']
50 | User-Agent: [Shippo/v1 PythonBindings/1.4.0]
51 | X-Shippo-Client-User-Agent: ['{"lang": "python", "publisher": "shippo", "httplib":
52 | "requests", "uname": "Darwin guozhen-shippo-mbp.local 16.4.0 Darwin Kernel
53 | Version 16.4.0: Thu Dec 22 22:53:21 PST 2016; root:xnu-3789.41.3~3/RELEASE_X86_64
54 | x86_64 i386", "lang_version": "2.7.10", "platform": "Darwin-16.4.0-x86_64-i386-64bit",
55 | "bindings_version": "1.4.0"}']
56 | method: GET
57 | uri: https://api.goshippo.com/addresses/e150f323a6d6445292f77a56aa082b8f/validate
58 | response:
59 | body:
60 | string: !!binary |
61 | H4sIAODy61gC/3WQX0vDMBTFv0rpsxtN09h1T9aCIIwN7ERUpGTt3Rppk5I/ihv77iaZpfrgW+49
62 | v5NzOadQ7N6h1lUtgWpowmUQxhFKZ1EyQ9E2RssoXsZ4ni7wS3gVjLQZmv/pZI4x+U0zD9b7/Y7u
63 | SHq9iJokie0zhnpB0oYghAgizsBUVYt+6ECDtWhpwC4/aMdsHBO8kqBMp5XVTo71ygT2oBQ9gJNf
64 | 385TvvjkIN0JByOOLfCbg1AtGwYxt2EultPe5YUraiQNbqGVwFXwZJzm7qH8y8mlN7ml0hJAV1y4
65 | 9bRAvhBEgmKVP28366DcTmL8l8XjWDN9+T1fB3cP+bq4L4vNhaO+hrDI3XhkgxuyBNnCUYbw5TrD
66 | tfT+x9IthlZwb4oiRAjBCcpw5lHoKevGUFue7ZI1wDWj3e8KNbVd05HToPSPev4GMLnd+CwCAAA=
67 | headers:
68 | allow: [OPTIONS]
69 | connection: [keep-alive]
70 | content-encoding: [gzip]
71 | content-length: ['341']
72 | content-type: [application/json]
73 | date: ['Mon, 10 Apr 2017 21:02:24 GMT']
74 | p3p: [CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"]
75 | server: [nginx/1.8.0]
76 | vary: ['Host, Cookie, Accept-Encoding']
77 | status: {code: 200, message: OK}
78 | version: 1
79 |
--------------------------------------------------------------------------------
/shippo/test/fixtures/batch/test_create:
--------------------------------------------------------------------------------
1 | interactions:
2 | - request:
3 | body: !!python/unicode '{"batch_shipments": [{"shipment": {"address_from": {"city":
4 | "San Francisco", "state": "CA", "name": "Mr Hippo", "zip": "94103", "country":
5 | "US", "street1": "965 Mission St", "street2": "Ste 201", "email": "mrhippo@goshippo.com",
6 | "phone": "4151234567"}, "parcel": {"weight": "2", "distance_unit": "in", "mass_unit":
7 | "oz", "height": "5", "width": "5", "length": "5"}, "address_to": {"city": "New
8 | York", "state": "NY", "name": "Mrs Hippo", "zip": "10007", "country": "US",
9 | "street1": "Broadway 1", "company": "", "street2": "", "phone": "4151234567",
10 | "email": "mrshippo@goshippo.com"}}}, {"shipment": {"address_from": {"city":
11 | "San Jose", "state": "CA", "name": "Mr Hippo", "zip": "95122", "country": "US",
12 | "street1": "1092 Indian Summer Ct", "email": "mrhippo@goshippo.com", "phone":
13 | "4151234567"}, "parcel": {"weight": "20", "distance_unit": "in", "mass_unit":
14 | "lb", "height": "5", "width": "5", "length": "5"}, "address_to": {"city": "New
15 | York", "state": "NY", "name": "Mrs Hippo", "zip": "10007", "country": "US",
16 | "street1": "Broadway 1", "company": "", "street2": "", "phone": "4151234567",
17 | "email": "mrshippo@goshippo.com"}}}], "label_filetype": "PDF_4x6", "default_servicelevel_token":
18 | "usps_priority", "default_carrier_account": "79f8ad5ea5de436fa6167ba39380cbe9",
19 | "metadata": "BATCH #170"}'
20 | headers:
21 | Accept: ['*/*']
22 | Accept-Encoding: ['gzip, deflate']
23 | Connection: [keep-alive]
24 | Content-Length: ['1295']
25 | Content-Type: [application/json]
26 | Shippo-API-Version: ['2017-03-29']
27 | User-Agent: [Shippo/v1 PythonBindings/1.4.0]
28 | X-Shippo-Client-User-Agent: ['{"lang": "python", "publisher": "shippo", "httplib":
29 | "requests", "uname": "Darwin Thiagos-MacBook-Pro.local 16.4.0 Darwin Kernel
30 | Version 16.4.0: Thu Dec 22 22:53:21 PST 2016; root:xnu-3789.41.3~3/RELEASE_X86_64
31 | x86_64 i386", "lang_version": "2.7.10", "platform": "Darwin-16.4.0-x86_64-i386-64bit",
32 | "bindings_version": "1.4.0"}']
33 | method: POST
34 | uri: https://api.goshippo.com/batches/
35 | response:
36 | body:
37 | string: !!binary |
38 | H4sIAPVQ3VgC/42RS08CMRSF/woZt0IGOg+GlShRSYxxQVxozOS2c8tUy7TpAyGE/+50lIcLE3ft
39 | Od999HQXKfqOzJWiiia9iBY4IlBkPK1oEmNMKWek4mleAE15lkeXvUOB+mzQhBpXC1iqq6WytdBa
40 | DZhaBcw6cN4G4Hn6MJ9NF/PHu7NyZhAcdkNH8TDvx6RP4sVwPCHFJCkGSTZ6OaO9rv5Dr9BBC0Lg
41 | rqeLm/vexTCPg1MhBy/bsWCMQFMCY8o3LoB5wcdQpQhphQnJOGTDLKdACjKOGcXivNyiWQuGEtco
42 | S6c+sAkdvNW21EYoI9w24BJo63Mh0W01BuRpdlsmmyyYFByryxDWChsXEtpFh2Xi1m9wE46Nl7K9
43 | aYNrobogfxSDtl0lCK9v+1NEJ3kXaW9YDRZL6xlDrLrkQu+jwaFd7qB2fyFU84f6q8n++Dxv5PcO
44 | X26GkDpEAgAA
45 | headers:
46 | allow: [OPTIONS]
47 | connection: [keep-alive]
48 | content-encoding: [gzip]
49 | content-length: ['351']
50 | content-type: [application/json]
51 | date: ['Thu, 30 Mar 2017 18:39:49 GMT']
52 | p3p: [CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"]
53 | server: [nginx/1.8.0]
54 | vary: ['Host, Cookie, Accept-Encoding']
55 | status: {code: 201, message: CREATED}
56 | version: 1
57 |
--------------------------------------------------------------------------------
/shippo/test/fixtures/batch/test_invalid_create:
--------------------------------------------------------------------------------
1 | interactions:
2 | - request:
3 | body: !!python/unicode '{}'
4 | headers:
5 | Accept: ['*/*']
6 | Accept-Encoding: ['gzip, deflate']
7 | Connection: [keep-alive]
8 | Content-Length: ['2']
9 | Content-Type: [application/json]
10 | Shippo-API-Version: ['2017-03-29']
11 | User-Agent: [Shippo/v1 PythonBindings/1.4.0]
12 | X-Shippo-Client-User-Agent: ['{"lang": "python", "publisher": "shippo", "httplib":
13 | "requests", "uname": "Darwin Thiagos-MacBook-Pro.local 16.4.0 Darwin Kernel
14 | Version 16.4.0: Thu Dec 22 22:53:21 PST 2016; root:xnu-3789.41.3~3/RELEASE_X86_64
15 | x86_64 i386", "lang_version": "2.7.10", "platform": "Darwin-16.4.0-x86_64-i386-64bit",
16 | "bindings_version": "1.4.0"}']
17 | method: POST
18 | uri: https://api.goshippo.com/batches/
19 | response:
20 | body:
21 | string: !!binary |
22 | H4sIAPxQ3VgC/1WPwU7EMAxEf8UKF1ZaWi3HnhHS3rhxiYTc1N0EpXaJXWCF+HeaLiA4+82b8Ycb
23 | yDBl14E78ivmNEAohEZQ6GUhtcbzQyZUAmJdCoFFglHKhAYywlmW8oNCL8MZkkKQUijU6P0GWuIT
24 | yGxJWDvPhwYek0VInBMTaEzzXInLFIXraDZr17Yn2W7SBJnaQYK2hUYqxIHaHjVe9Wghkt5cJu88
25 | 336r6T3p1vorl/55nQTHO92D4kSAa9Fht4d+sfWBOWMg8G4zPtXURGzqHbxVH0JehfXhf+bK/DF7
26 | dp9fgu4EXVIBAAA=
27 | headers:
28 | allow: [OPTIONS]
29 | connection: [keep-alive]
30 | content-encoding: [gzip]
31 | content-length: ['239']
32 | content-type: [application/json]
33 | date: ['Thu, 30 Mar 2017 18:39:56 GMT']
34 | p3p: [CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"]
35 | server: [nginx/1.8.0]
36 | vary: ['Host, Cookie, Accept-Encoding']
37 | status: {code: 400, message: BAD REQUEST}
38 | - request:
39 | body: !!python/unicode '{"label_filetype": "PDF_4x6", "metadata": "teehee", "default_servicelevel_token":
40 | "usps_priority", "default_carrier_account": "NOT_VALID", "batch_shipments":
41 | []}'
42 | headers:
43 | Accept: ['*/*']
44 | Accept-Encoding: ['gzip, deflate']
45 | Connection: [keep-alive]
46 | Content-Length: ['161']
47 | Content-Type: [application/json]
48 | Shippo-API-Version: ['2017-03-29']
49 | User-Agent: [Shippo/v1 PythonBindings/1.4.0]
50 | X-Shippo-Client-User-Agent: ['{"lang": "python", "publisher": "shippo", "httplib":
51 | "requests", "uname": "Darwin Thiagos-MacBook-Pro.local 16.4.0 Darwin Kernel
52 | Version 16.4.0: Thu Dec 22 22:53:21 PST 2016; root:xnu-3789.41.3~3/RELEASE_X86_64
53 | x86_64 i386", "lang_version": "2.7.10", "platform": "Darwin-16.4.0-x86_64-i386-64bit",
54 | "bindings_version": "1.4.0"}']
55 | method: POST
56 | uri: https://api.goshippo.com/batches/
57 | response:
58 | body: {string: !!python/unicode '{"default_carrier_account": ["Invalid account
59 | object_id provided ''NOT_VALID''. Please list the available CarrierAccount
60 | objects (/v1/carrier_accounts) to get your valid object_ids."]}'}
61 | headers:
62 | allow: [OPTIONS]
63 | connection: [keep-alive]
64 | content-length: ['182']
65 | content-type: [application/json]
66 | date: ['Thu, 30 Mar 2017 18:39:56 GMT']
67 | p3p: [CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"]
68 | server: [nginx/1.8.0]
69 | vary: ['Host, Cookie']
70 | status: {code: 400, message: BAD REQUEST}
71 | version: 1
72 |
--------------------------------------------------------------------------------
/shippo/test/fixtures/batch/test_invalid_purchase:
--------------------------------------------------------------------------------
1 | interactions:
2 | - request:
3 | body: !!python/unicode 'null'
4 | headers:
5 | Accept: ['*/*']
6 | Accept-Encoding: ['gzip, deflate']
7 | Connection: [keep-alive]
8 | Content-Length: ['4']
9 | Content-Type: [application/json]
10 | Shippo-API-Version: ['2017-03-29']
11 | User-Agent: [Shippo/v1 PythonBindings/1.4.0]
12 | X-Shippo-Client-User-Agent: ['{"lang": "python", "publisher": "shippo", "httplib":
13 | "requests", "uname": "Darwin Thiagos-MacBook-Pro.local 16.4.0 Darwin Kernel
14 | Version 16.4.0: Thu Dec 22 22:53:21 PST 2016; root:xnu-3789.41.3~3/RELEASE_X86_64
15 | x86_64 i386", "lang_version": "2.7.10", "platform": "Darwin-16.4.0-x86_64-i386-64bit",
16 | "bindings_version": "1.4.0"}']
17 | method: POST
18 | uri: https://api.goshippo.com/batches/INVALID_OBJECT_ID/purchase
19 | response:
20 | body:
21 | string: !!binary |
22 | H4sIAAAAAAAAAxXMQQrCMBAF0Kv8Ezh0HwLaKkRKBWndltiOjJskZpJ6fevybZ6Rxg6x4BJrWA3t
23 | MsmOwsj8qayFV0z3HrQ19PRlEVZyw+PYu26+na7ndpxdR6nmRbwyvl4R9u313xADirwVynnjfDCU
24 | 7A9DZqiybwAAAA==
25 | headers:
26 | connection: [keep-alive]
27 | content-encoding: [gzip]
28 | content-length: ['124']
29 | content-type: [text/html]
30 | date: ['Thu, 30 Mar 2017 18:39:57 GMT']
31 | p3p: [CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"]
32 | server: [nginx/1.8.0]
33 | vary: ['Host, Cookie']
34 | status: {code: 404, message: NOT FOUND}
35 | version: 1
36 |
--------------------------------------------------------------------------------
/shippo/test/fixtures/batch/test_invalid_retrieve:
--------------------------------------------------------------------------------
1 | interactions:
2 | - request:
3 | body: null
4 | headers:
5 | Accept: ['*/*']
6 | Accept-Encoding: ['gzip, deflate']
7 | Connection: [keep-alive]
8 | Content-Type: [application/json]
9 | Shippo-API-Version: ['2017-03-29']
10 | User-Agent: [Shippo/v1 PythonBindings/1.4.0]
11 | X-Shippo-Client-User-Agent: ['{"lang": "python", "publisher": "shippo", "httplib":
12 | "requests", "uname": "Darwin Thiagos-MacBook-Pro.local 16.4.0 Darwin Kernel
13 | Version 16.4.0: Thu Dec 22 22:53:21 PST 2016; root:xnu-3789.41.3~3/RELEASE_X86_64
14 | x86_64 i386", "lang_version": "2.7.10", "platform": "Darwin-16.4.0-x86_64-i386-64bit",
15 | "bindings_version": "1.4.0"}']
16 | method: GET
17 | uri: https://api.goshippo.com/batches/EXAMPLE_OF_INVALID_ID
18 | response:
19 | body:
20 | string: !!binary |
21 | H4sIAAAAAAAAA7PJMLTzyy9RcMsvzUux0QfybArsQjJSFYpSC0tTi0tSUxRCg3wU9MsM9ZMSS5Iz
22 | Uov1XSMcfQN8XOP93eI9/cIcfTxd4j1dFMoTixXygAalgQxSyM9TKMnILFYoTi0qSy3Ss9EvsAMA
23 | nBN1WmoAAAA=
24 | headers:
25 | connection: [keep-alive]
26 | content-encoding: [gzip]
27 | content-length: ['122']
28 | content-type: [text/html]
29 | date: ['Thu, 30 Mar 2017 18:39:59 GMT']
30 | p3p: [CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"]
31 | server: [nginx/1.8.0]
32 | vary: ['Host, Cookie']
33 | status: {code: 404, message: NOT FOUND}
34 | version: 1
35 |
--------------------------------------------------------------------------------
/shippo/test/fixtures/customs-declaration/test_create:
--------------------------------------------------------------------------------
1 | interactions:
2 | - request:
3 | body: !!python/unicode '{"origin_country": "US", "description": "T-Shirt", "quantity":
4 | 2, "mass_unit": "g", "value_currency": "USD", "net_weight": "400", "tariff_number":
5 | "", "value_amount": "20", "metadata": "Order ID #123123"}'
6 | headers:
7 | Accept: ['*/*']
8 | Accept-Encoding: ['gzip, deflate']
9 | Connection: [keep-alive]
10 | Content-Length: ['204']
11 | Content-Type: [application/json]
12 | Shippo-API-Version: ['2017-03-29']
13 | User-Agent: [Shippo/v1 PythonBindings/1.4.0]
14 | X-Shippo-Client-User-Agent: ['{"lang": "python", "publisher": "shippo", "httplib":
15 | "requests", "uname": "Darwin guozhen-shippo-mbp.local 16.4.0 Darwin Kernel
16 | Version 16.4.0: Thu Dec 22 22:53:21 PST 2016; root:xnu-3789.41.3~3/RELEASE_X86_64
17 | x86_64 i386", "lang_version": "2.7.10", "platform": "Darwin-16.4.0-x86_64-i386-64bit",
18 | "bindings_version": "1.4.0"}']
19 | method: POST
20 | uri: https://api.goshippo.com/customs/items/
21 | response:
22 | body:
23 | string: !!binary |
24 | H4sIAOfy61gC/32QsU7DMBCGXyUKK61sJzRtJ5C6VEJiaGFgiRz7khgaO9hnKkC8O74URMWA5MXf
25 | fXf+zx+5a55AYa08SASdr7NcMF7NWDnjbC/4mol1wefVkj/ml9mPHUf9vy3ObTOJ7aJq2qISomS8
26 | vFo1DVerQi0Xy1JroXV11uCOFjz1dNG992CvOxd6M45urtxw5gVMKch7uLndbqigIShvRjTOEt/P
27 | dr3xSJWXKC0afEtYpKsFrI9guh7JKxkjZ5Ah1NGaiXVEXuUhQi0HFy2etv2lKnoPVtHE/H43Pe+8
28 | 6YytFen+u0AcpTdtW9s4NKfFCPYhiZry23g4JBCe4x8yAMr005Ja7rwGn2032QUXRTrTXAgUC32E
29 | zy+B5yNkywEAAA==
30 | headers:
31 | allow: [OPTIONS]
32 | connection: [keep-alive]
33 | content-encoding: [gzip]
34 | content-length: ['295']
35 | content-type: [application/json]
36 | date: ['Mon, 10 Apr 2017 21:02:31 GMT']
37 | p3p: [CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"]
38 | server: [nginx/1.8.0]
39 | vary: ['Host, Cookie, Accept-Encoding']
40 | status: {code: 201, message: CREATED}
41 | - request:
42 | body: !!python/unicode '{"aes_itn": "", "incoterm": "", "certify_signer": "Laura
43 | Behrens Wu", "certificate": "", "license": "", "exporter_reference": "", "contents_type":
44 | "MERCHANDISE", "items": ["f67bf3722401459bb1c93c8684dd2dd7"], "notes": "", "certify":
45 | true, "eel_pfc": "NOEEI_30_37_a", "non_delivery_option": "ABANDON", "invoice":
46 | "#123123", "importer_reference": "", "metadata": "Order ID #123123", "contents_explanation":
47 | "T-Shirt purchase", "disclaimer": ""}'
48 | headers:
49 | Accept: ['*/*']
50 | Accept-Encoding: ['gzip, deflate']
51 | Connection: [keep-alive]
52 | Content-Length: ['442']
53 | Content-Type: [application/json]
54 | Shippo-API-Version: ['2017-03-29']
55 | User-Agent: [Shippo/v1 PythonBindings/1.4.0]
56 | X-Shippo-Client-User-Agent: ['{"lang": "python", "publisher": "shippo", "httplib":
57 | "requests", "uname": "Darwin guozhen-shippo-mbp.local 16.4.0 Darwin Kernel
58 | Version 16.4.0: Thu Dec 22 22:53:21 PST 2016; root:xnu-3789.41.3~3/RELEASE_X86_64
59 | x86_64 i386", "lang_version": "2.7.10", "platform": "Darwin-16.4.0-x86_64-i386-64bit",
60 | "bindings_version": "1.4.0"}']
61 | method: POST
62 | uri: https://api.goshippo.com/customs/declarations/
63 | response:
64 | body:
65 | string: !!binary |
66 | H4sIAOjy61gC/5WSUU/bMBSF/0oUXlcU2yFp+rSyVqIStNJATBpClmPfNJ4SO7IdoEP8d+ykgfKw
67 | h0l+OT6f7z2+9musyz/AHeUGmAMRL6IYJyifJekMJXcYLRK8IPicFOR3/C2a6L4T/0HLARRFyou5
68 | QCVBIi0zxLKyRHPGOfbbkGQnB/SzAhPO7Hv9twb1fa9tLbtOn3PdnnDW+RSBu19eb1bB4GCcrA7U
69 | yv2xxDXrDYsuoTagbPSrP6G87UwPfkM6aK2XD3GV5WVFcozTBKUXhY/IC8Ln2TwVAguRx48eV1pR
70 | AY18AnOgunNSq9BqebncrnbboYNWDpSz1B26IeHN+uePK29vbtdffHjpGqbYVOJudltL46KuN7xm
71 | FgLrEW0cGGqgAn8LPhQMjmz/6agnLUd5hjDxa+zatmC4ZA39BCrW2DCDxktlPyqMM5L8OOF4uLYD
72 | OwmAhnYVD3K7W683lCSU5JQFj4Gl0qkJFdLyhsl2fJAxHve1TDvpFhzzP4oFvTMCTLRZRSfBfV93
73 | fK23d6gQTsizAgAA
74 | headers:
75 | allow: [OPTIONS]
76 | connection: [keep-alive]
77 | content-encoding: [gzip]
78 | content-length: ['411']
79 | content-type: [application/json]
80 | date: ['Mon, 10 Apr 2017 21:02:32 GMT']
81 | p3p: [CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"]
82 | server: [nginx/1.8.0]
83 | vary: ['Host, Cookie, Accept-Encoding']
84 | status: {code: 201, message: CREATED}
85 | version: 1
86 |
--------------------------------------------------------------------------------
/shippo/test/fixtures/customs-declaration/test_invalid_create:
--------------------------------------------------------------------------------
1 | interactions:
2 | - request:
3 | body: !!python/unicode '{"aes_itn": "", "incoterm": "", "certify_signer": "Laura
4 | Behrens Wu", "certificate": "", "license": "", "exporter_reference": "", "contents_type":
5 | "MERCHANDISE", "notes": "", "cerfy": true, "eel_pfc": "NOEEI_30_37_a", "non_delivery_option":
6 | "ABANDON", "invoice": "#123123", "importer_reference": "", "metadata": "Order
7 | ID #123123", "contents_explanation": "T-Shirt purchase", "disclaimer": ""}'
8 | headers:
9 | Accept: ['*/*']
10 | Accept-Encoding: ['gzip, deflate']
11 | Connection: [keep-alive]
12 | Content-Length: ['393']
13 | Content-Type: [application/json]
14 | Shippo-API-Version: ['2017-03-29']
15 | User-Agent: [Shippo/v1 PythonBindings/1.4.0]
16 | X-Shippo-Client-User-Agent: ['{"lang": "python", "publisher": "shippo", "httplib":
17 | "requests", "uname": "Darwin guozhen-shippo-mbp.local 16.4.0 Darwin Kernel
18 | Version 16.4.0: Thu Dec 22 22:53:21 PST 2016; root:xnu-3789.41.3~3/RELEASE_X86_64
19 | x86_64 i386", "lang_version": "2.7.10", "platform": "Darwin-16.4.0-x86_64-i386-64bit",
20 | "bindings_version": "1.4.0"}']
21 | method: POST
22 | uri: https://api.goshippo.com/customs/declarations/
23 | response:
24 | body: {string: !!python/unicode '{"items": ["This field is required."]}'}
25 | headers:
26 | allow: [OPTIONS]
27 | connection: [keep-alive]
28 | content-length: ['38']
29 | content-type: [application/json]
30 | date: ['Mon, 10 Apr 2017 21:02:33 GMT']
31 | p3p: [CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"]
32 | server: [nginx/1.8.0]
33 | vary: ['Host, Cookie']
34 | status: {code: 400, message: BAD REQUEST}
35 | version: 1
36 |
--------------------------------------------------------------------------------
/shippo/test/fixtures/customs-declaration/test_invalid_retrieve:
--------------------------------------------------------------------------------
1 | interactions:
2 | - request:
3 | body: null
4 | headers:
5 | Accept: ['*/*']
6 | Accept-Encoding: ['gzip, deflate']
7 | Connection: [keep-alive]
8 | Content-Type: [application/json]
9 | Shippo-API-Version: ['2017-03-29']
10 | User-Agent: [Shippo/v1 PythonBindings/1.4.0]
11 | X-Shippo-Client-User-Agent: ['{"lang": "python", "publisher": "shippo", "httplib":
12 | "requests", "uname": "Darwin guozhen-shippo-mbp.local 16.4.0 Darwin Kernel
13 | Version 16.4.0: Thu Dec 22 22:53:21 PST 2016; root:xnu-3789.41.3~3/RELEASE_X86_64
14 | x86_64 i386", "lang_version": "2.7.10", "platform": "Darwin-16.4.0-x86_64-i386-64bit",
15 | "bindings_version": "1.4.0"}']
16 | method: GET
17 | uri: https://api.goshippo.com/customs/declarations/EXAMPLE_OF_INVALID_ID
18 | response:
19 | body:
20 | string: !!binary |
21 | H4sIAAAAAAAAAxXMQQrCMBAAwK/sC1x6D4FCWwjEKmLFWwjNSgqardmk/b71OJdRsdEjFxi4pqDw
22 | kFr1PRJk+laSQgGmmwXcGpyrFP4IBprfPvuycBLsn+35ant3GZwZH601nTMd7F4gHevrvwInKHER
23 | EMob5ZPCVf8AjLaFGHcAAAA=
24 | headers:
25 | connection: [keep-alive]
26 | content-encoding: [gzip]
27 | content-length: ['131']
28 | content-type: [text/html]
29 | date: ['Mon, 10 Apr 2017 21:02:33 GMT']
30 | p3p: [CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"]
31 | server: [nginx/1.8.0]
32 | vary: ['Host, Cookie']
33 | status: {code: 404, message: NOT FOUND}
34 | version: 1
35 |
--------------------------------------------------------------------------------
/shippo/test/fixtures/customs-declaration/test_list_all:
--------------------------------------------------------------------------------
1 | interactions:
2 | - request:
3 | body: null
4 | headers:
5 | Accept: ['*/*']
6 | Accept-Encoding: ['gzip, deflate']
7 | Connection: [keep-alive]
8 | Content-Type: [application/json]
9 | Shippo-API-Version: ['2017-03-29']
10 | User-Agent: [Shippo/v1 PythonBindings/1.4.0]
11 | X-Shippo-Client-User-Agent: ['{"lang": "python", "publisher": "shippo", "httplib":
12 | "requests", "uname": "Darwin guozhen-shippo-mbp.local 16.4.0 Darwin Kernel
13 | Version 16.4.0: Thu Dec 22 22:53:21 PST 2016; root:xnu-3789.41.3~3/RELEASE_X86_64
14 | x86_64 i386", "lang_version": "2.7.10", "platform": "Darwin-16.4.0-x86_64-i386-64bit",
15 | "bindings_version": "1.4.0"}']
16 | method: GET
17 | uri: https://api.goshippo.com/customs/declarations/
18 | response:
19 | body:
20 | string: !!binary |
21 | H4sIAOry61gC/+2WbWvjRhDHv4px317sfRitdgWlzTWGC9wlkEtbaDnE7O4oVpElsVqllx733buy
22 | ndalbdyjHHUh4Dcz89+Z2dkfY32Yu25s47yYKQYvZvOW3k/GfB1jPxTLJfb14q4b1nXfdwvXbZb3
23 | fOnGIXabYenJNRgw1l07LL/q8Y6+FPOUow90X3fjkPK0Y9MkT6BhbOLk+PHDvLM/kYulC4SR/FRM
24 | MJ6fMTjj7FbwgolCioU08ocp2V499v4T1PVW6A04oz23knuwiqOylmt0TiQ3MXVwoPu5pTCduRu7
25 | X9bUfn145wPdEFMXk+6789eXF1PAUYh19VAO9d0+xWscA85e0jpQO8y+Hw9UKRzDSMlRR9ps5zGv
26 | VG4rmQsBjENmUovOSKeVBu+F9/n83fQsXVt6aup7Cg9l108jn0qdvzy/uri+2lbo2khtHMr40G87
27 | fLO6+eZVCl++Xf0hTu/7Blt8THF79nZdhzjrx+DWONCkTZIuRAploIrSLdw24RSpN38bae+7emd+
28 | wYVMv13VzYaCq7EpfxdU2AzTDJpktsNvGXYzqt1+wvPttSMNjwZRU/aVm8yr69XqspSslHmJUwxp
29 | KOvYPkp9PSQ0683uQXbtuZQrbB7tDUVMROFkXwdPYXZ5MTtoPNWN+9f6+GJ2BFqui0wVUi2kFMeh
30 | 3avzBQP2Z2gzl1gWmQaBAijP0CqHPnm8VVIY+EzQvgmzV9PRI7B6U8nKMQuS52ArnppztnI8Y5C6
31 | I/0UrDer229vTo3Vzwjpv+by0zhk6pZBAbJgZpFl5giHT6h3HGKFlZUkyGsEz9BYQxbQpb8JT57z
32 | E1meQKQdMm+EBp4BImaQKWU5B1ll+Lw8T3t5HmIo2bHl+YR6B21OSiEBVRoY5JLr3GhmSCBNmzTP
33 | TgNal6cFKmziM88BjNMCM0ES0q7PNLP8Gdr/BbSsEGzBmf5n0P6VegctVxZBgNS5FOAY6FxJ6Sxk
34 | tiJPFZ4GtNZIUzGTe6YkaA5aIdr0GS2RS2/BPEP7X0P77uOv2YXLis0NAAA=
35 | headers:
36 | allow: [OPTIONS]
37 | connection: [keep-alive]
38 | content-encoding: [gzip]
39 | content-length: ['785']
40 | content-type: [application/json]
41 | date: ['Mon, 10 Apr 2017 21:02:34 GMT']
42 | p3p: [CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"]
43 | server: [nginx/1.8.0]
44 | vary: ['Host, Cookie, Accept-Encoding']
45 | status: {code: 200, message: OK}
46 | version: 1
47 |
--------------------------------------------------------------------------------
/shippo/test/fixtures/customs-declaration/test_list_page_size:
--------------------------------------------------------------------------------
1 | interactions:
2 | - request:
3 | body: null
4 | headers:
5 | Accept: ['*/*']
6 | Accept-Encoding: ['gzip, deflate']
7 | Connection: [keep-alive]
8 | Content-Type: [application/json]
9 | Shippo-API-Version: ['2017-03-29']
10 | User-Agent: [Shippo/v1 PythonBindings/1.4.0]
11 | X-Shippo-Client-User-Agent: ['{"lang": "python", "publisher": "shippo", "httplib":
12 | "requests", "uname": "Darwin guozhen-shippo-mbp.local 16.4.0 Darwin Kernel
13 | Version 16.4.0: Thu Dec 22 22:53:21 PST 2016; root:xnu-3789.41.3~3/RELEASE_X86_64
14 | x86_64 i386", "lang_version": "2.7.10", "platform": "Darwin-16.4.0-x86_64-i386-64bit",
15 | "bindings_version": "1.4.0"}']
16 | method: GET
17 | uri: https://api.goshippo.com/customs/declarations/?results=1
18 | response:
19 | body:
20 | string: !!binary |
21 | H4sIAOry61gC/5VSXWvbMBT9K8aDPS2xZXtOHChbugQW6BJYSwsbRcjSdaxhS0IfWdPS/z7Jcbbs
22 | YQ8DvZx7js79fImpdMLGi6hMi3dRLOApgLi1VplFkhDFp3tpWq6UnFLZJweUUGes7E3CgHZEE8ul
23 | MMkHDcZ11lyht4rs4SqLvZvScODSGe8oXNf5yKjyge8vsax/ALWYaiAWWEibpWg2SYsJSu8ytEiz
24 | RZ5N8yr/FsxGtVPsP9R8ELKqoNWcoTpHrKhLRMq6RnNCaebDkJYXH+RPATr82Tv53IL4eNn9hc5Y
25 | X0XQ3S9vNqtAUNCWN0ds+H60uCFOk+gaWg3CRA/uQuVpqx34ALfQD/OIm3JWN/ksy4oUFe8rXyKt
26 | cjov5wVjGWOz+DEsSArMoOMH0EcsVRh+SLW8Xm5Xu+2QQQoLwhpsj2qo8Mv666fPnt7crv/i4Ul1
27 | RJCzxd3ktuXaRspp2hIDQeslUlvQWEMDvgs6GAaG9/9kxEHyE3yDsty/U9a+B0056fAfQUM6E2bQ
28 | eSjMb4fTjDgdJxwPbVswZwDQYdXQALe79XqD8xTnM0wCR8BgbsVZyrjxR8r700JO5VHvpfsz7sES
29 | f1Ek4J1moKPNKroo3Oe147ZeH19/Adg4vckwAwAA
30 | headers:
31 | allow: [OPTIONS]
32 | connection: [keep-alive]
33 | content-encoding: [gzip]
34 | content-length: ['486']
35 | content-type: [application/json]
36 | date: ['Mon, 10 Apr 2017 21:02:34 GMT']
37 | p3p: [CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"]
38 | server: [nginx/1.8.0]
39 | vary: ['Host, Cookie, Accept-Encoding']
40 | status: {code: 200, message: OK}
41 | version: 1
42 |
--------------------------------------------------------------------------------
/shippo/test/fixtures/customs-item/test_create:
--------------------------------------------------------------------------------
1 | interactions:
2 | - request:
3 | body: !!python/unicode '{"origin_country": "US", "description": "T-Shirt", "quantity":
4 | 2, "mass_unit": "g", "value_currency": "USD", "net_weight": "400", "tariff_number":
5 | "", "value_amount": "20", "metadata": "Order ID #123123"}'
6 | headers:
7 | Accept: ['*/*']
8 | Accept-Encoding: ['gzip, deflate']
9 | Connection: [keep-alive]
10 | Content-Length: ['204']
11 | Content-Type: [application/json]
12 | Shippo-API-Version: ['2017-03-29']
13 | User-Agent: [Shippo/v1 PythonBindings/1.4.0]
14 | X-Shippo-Client-User-Agent: ['{"lang": "python", "publisher": "shippo", "httplib":
15 | "requests", "uname": "Darwin guozhen-shippo-mbp.local 16.4.0 Darwin Kernel
16 | Version 16.4.0: Thu Dec 22 22:53:21 PST 2016; root:xnu-3789.41.3~3/RELEASE_X86_64
17 | x86_64 i386", "lang_version": "2.7.10", "platform": "Darwin-16.4.0-x86_64-i386-64bit",
18 | "bindings_version": "1.4.0"}']
19 | method: POST
20 | uri: https://api.goshippo.com/customs/items/
21 | response:
22 | body:
23 | string: !!binary |
24 | H4sIAO3y61gC/5WQz0+DMBSA/xWCV1mgELpx0mSXJSYeNj14IaU8oAottq8uavzf7WMal91Memi/
25 | 971f/YxN8wwSa2lBILRxFcUszXiSFkmWHlhWpazK+apYb57i6+jX9nP7D1st4oZ1mczXHeQNLwoe
26 | bmVeQik4cC45Y2cJ5qjBUk7vzccA+qY3blDzbFbSTGeewzAFeY+3d7stBVpw0qoZldHED8l+UBYp
27 | 8uqFRoXvAbPw1ID1EVQ/IHlFmpIzCedqr9XCeiJvYvRQi8l4jadt/6j01oKWVDF+2C/tjVW90rUk
28 | 3f4EiKOwqutq7afmtBjBwQWxpfm1H8cA3Iu/IBOgCD8tKOXetmCj3Ta6ylgezlIXHI2F1sPXN4Xn
29 | cBPLAQAA
30 | headers:
31 | allow: [OPTIONS]
32 | connection: [keep-alive]
33 | content-encoding: [gzip]
34 | content-length: ['291']
35 | content-type: [application/json]
36 | date: ['Mon, 10 Apr 2017 21:02:37 GMT']
37 | p3p: [CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"]
38 | server: [nginx/1.8.0]
39 | vary: ['Host, Cookie, Accept-Encoding']
40 | status: {code: 201, message: CREATED}
41 | version: 1
42 |
--------------------------------------------------------------------------------
/shippo/test/fixtures/customs-item/test_invalid_create:
--------------------------------------------------------------------------------
1 | interactions:
2 | - request:
3 | body: !!python/unicode '{"tariff_number": "", "value_currency": "USD", "origin_country":
4 | "US", "metadata": "Order ID #123123"}'
5 | headers:
6 | Accept: ['*/*']
7 | Accept-Encoding: ['gzip, deflate']
8 | Connection: [keep-alive]
9 | Content-Length: ['102']
10 | Content-Type: [application/json]
11 | Shippo-API-Version: ['2017-03-29']
12 | User-Agent: [Shippo/v1 PythonBindings/1.4.0]
13 | X-Shippo-Client-User-Agent: ['{"lang": "python", "publisher": "shippo", "httplib":
14 | "requests", "uname": "Darwin guozhen-shippo-mbp.local 16.4.0 Darwin Kernel
15 | Version 16.4.0: Thu Dec 22 22:53:21 PST 2016; root:xnu-3789.41.3~3/RELEASE_X86_64
16 | x86_64 i386", "lang_version": "2.7.10", "platform": "Darwin-16.4.0-x86_64-i386-64bit",
17 | "bindings_version": "1.4.0"}']
18 | method: POST
19 | uri: https://api.goshippo.com/customs/items/
20 | response:
21 | body:
22 | string: !!binary |
23 | H4sIAO7y61gC/4XMwQmAMAxA0VVKzuIAzuFNpBQbNdCm2iaKiLvrBPb2D49/w+GConUxKQt0ZoB+
24 | pWJmwuDNFxl3pYy+hbExEF0pVpnq0mOZMm1CiauWUeyJtKz17a6OheT6h88L92J9StcAAAA=
25 | headers:
26 | allow: [OPTIONS]
27 | connection: [keep-alive]
28 | content-encoding: [gzip]
29 | content-length: ['110']
30 | content-type: [application/json]
31 | date: ['Mon, 10 Apr 2017 21:02:38 GMT']
32 | p3p: [CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"]
33 | server: [nginx/1.8.0]
34 | vary: ['Host, Cookie, Accept-Encoding']
35 | status: {code: 400, message: BAD REQUEST}
36 | version: 1
37 |
--------------------------------------------------------------------------------
/shippo/test/fixtures/customs-item/test_invalid_retrieve:
--------------------------------------------------------------------------------
1 | interactions:
2 | - request:
3 | body: null
4 | headers:
5 | Accept: ['*/*']
6 | Accept-Encoding: ['gzip, deflate']
7 | Connection: [keep-alive]
8 | Content-Type: [application/json]
9 | Shippo-API-Version: ['2017-03-29']
10 | User-Agent: [Shippo/v1 PythonBindings/1.4.0]
11 | X-Shippo-Client-User-Agent: ['{"lang": "python", "publisher": "shippo", "httplib":
12 | "requests", "uname": "Darwin guozhen-shippo-mbp.local 16.4.0 Darwin Kernel
13 | Version 16.4.0: Thu Dec 22 22:53:21 PST 2016; root:xnu-3789.41.3~3/RELEASE_X86_64
14 | x86_64 i386", "lang_version": "2.7.10", "platform": "Darwin-16.4.0-x86_64-i386-64bit",
15 | "bindings_version": "1.4.0"}']
16 | method: GET
17 | uri: https://api.goshippo.com/customs/items/EXAMPLE_OF_INVALID_ID
18 | response:
19 | body:
20 | string: !!binary |
21 | H4sIAAAAAAAAA7PJMLTzyy9RcMsvzUux0QfybArsQjJSFYpSC0tTi0tSUxRCg3wU9MsM9ZNLi0vy
22 | c4v1M0tSgaRrhKNvgI9rvL9bvKdfmKOPp0u8p4tCeWKxQh7QuDSQcQr5eQolGZnFCsWpRWWpRXo2
23 | +gV2ALEDqXxwAAAA
24 | headers:
25 | connection: [keep-alive]
26 | content-encoding: [gzip]
27 | content-length: ['126']
28 | content-type: [text/html]
29 | date: ['Mon, 10 Apr 2017 21:02:38 GMT']
30 | p3p: [CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"]
31 | server: [nginx/1.8.0]
32 | vary: ['Host, Cookie']
33 | status: {code: 404, message: NOT FOUND}
34 | version: 1
35 |
--------------------------------------------------------------------------------
/shippo/test/fixtures/customs-item/test_list_all:
--------------------------------------------------------------------------------
1 | interactions:
2 | - request:
3 | body: null
4 | headers:
5 | Accept: ['*/*']
6 | Accept-Encoding: ['gzip, deflate']
7 | Connection: [keep-alive]
8 | Content-Type: [application/json]
9 | Shippo-API-Version: ['2017-03-29']
10 | User-Agent: [Shippo/v1 PythonBindings/1.4.0]
11 | X-Shippo-Client-User-Agent: ['{"lang": "python", "publisher": "shippo", "httplib":
12 | "requests", "uname": "Darwin guozhen-shippo-mbp.local 16.4.0 Darwin Kernel
13 | Version 16.4.0: Thu Dec 22 22:53:21 PST 2016; root:xnu-3789.41.3~3/RELEASE_X86_64
14 | x86_64 i386", "lang_version": "2.7.10", "platform": "Darwin-16.4.0-x86_64-i386-64bit",
15 | "bindings_version": "1.4.0"}']
16 | method: GET
17 | uri: https://api.goshippo.com/customs/items/
18 | response:
19 | body:
20 | string: !!binary |
21 | H4sIAO/y61gC/+2T22rbQBCGX8Wot7G8J+9KgtIWchMo9CJpL1qK2cPI3taW1D04bUPevbuSoaan
22 | OFByZSGE9M8/o5n9mLtC97ELRTPDuOYXs6KDr/mr2IQw+GaxkIMt173f2GHoS93vFnu80NGHfucX
23 | NkB6vhjkGp6TIiUPDva2jz4V6OJ2mxQHPm5DFj7cFb36BDqstAMZwOS/EITFHLE5RjcEN4g0VJSs
24 | qt/nYgd3HMwj3HY01qTFmlYtUCUYE+mNUw5cChBCC0KOEvrbDlzOWcf++wa6l8fDHvl8SF1k37tX
25 | r68uc8CA184OwfZd1m/m1xvrQo58ibILNnxLMhmPNKxuwa4348EyhEqUrmzcSe9XsbNjYJ2VvdxG
26 | WMndAUoauZysU0BH56DTuXLx9npso3d2bbvViNEdAlkP0tm2XXVxp6YBs7jxyWjgJx//Of6i7CDI
27 | dOIyp7xxBtzs6nL2DBOa7rEu+NxZcBHuL2anQV2WHJOTof7mnqByZJSsSK1ZTdnSCKVST6yWVNIl
28 | BoXPUJ8WKi5FhU+Gmt1/gNpyoVqaVpIhzJa1UljXVFe8YsYQY8QZ6hNBxVWz5A3lJSX8Yah/c09Q
29 | Td3SViPFKBZMtVhxrVWr8RIxTglUZ6inQX0cRMRvEGsYbTAqMX9oM//hniCiukJQCUHbBLHKNDHU
30 | tCZGY0mgpWeI/2czP97/AGQnc06ECQAA
31 | headers:
32 | allow: [OPTIONS]
33 | connection: [keep-alive]
34 | content-encoding: [gzip]
35 | content-length: ['537']
36 | content-type: [application/json]
37 | date: ['Mon, 10 Apr 2017 21:02:39 GMT']
38 | p3p: [CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"]
39 | server: [nginx/1.8.0]
40 | vary: ['Host, Cookie, Accept-Encoding']
41 | status: {code: 200, message: OK}
42 | version: 1
43 |
--------------------------------------------------------------------------------
/shippo/test/fixtures/customs-item/test_list_page_size:
--------------------------------------------------------------------------------
1 | interactions:
2 | - request:
3 | body: null
4 | headers:
5 | Accept: ['*/*']
6 | Accept-Encoding: ['gzip, deflate']
7 | Connection: [keep-alive]
8 | Content-Type: [application/json]
9 | Shippo-API-Version: ['2017-03-29']
10 | User-Agent: [Shippo/v1 PythonBindings/1.4.0]
11 | X-Shippo-Client-User-Agent: ['{"lang": "python", "publisher": "shippo", "httplib":
12 | "requests", "uname": "Darwin guozhen-shippo-mbp.local 16.4.0 Darwin Kernel
13 | Version 16.4.0: Thu Dec 22 22:53:21 PST 2016; root:xnu-3789.41.3~3/RELEASE_X86_64
14 | x86_64 i386", "lang_version": "2.7.10", "platform": "Darwin-16.4.0-x86_64-i386-64bit",
15 | "bindings_version": "1.4.0"}']
16 | method: GET
17 | uri: https://api.goshippo.com/customs/items/?results=1
18 | response:
19 | body:
20 | string: !!binary |
21 | H4sIAPDy61gC/5VRXUvDMBT9K6OCT65t0rJshaHCXgaCD5s+KFKy9K6NrklNbjZ1+N9NuoLDN0MI
22 | yTnnntyPYyS0UxgVI0Jmk6tRpOAjvKIGsbNFkvBOxrW2jew6HQvdJnuSCGdRtzaRCP68NmDdDu2c
23 | XHa8hjmNvE1nYC+1s95Kud3OI4PKA8/HSG9eQWApDHCEKvxHU8LGaT4m6ZqSIqVFxuJ8OnsKZoPa
24 | ddU/1LIXzuiWiGy6hWzD8pz52ySbwIQzYEwwSs8C9EGBCTG1018NqJvzss90Fn0WQfd4e7dcBKIC
25 | K4zsUGoV8PV41UiDgXl3XKHETw/TvrlYHkDWTd/iPE3j1K8gbLm1pVOyJ+qA7PnOQcnbYTy+5Pgk
26 | PRHCGQNKBOfoYdWnoY2spSr7gZqBCDhyI7fbUrl2cyowgI31wgp+52Pf3B+kBeS+4zyE3JsKzGi5
27 | GF0Qmvnd+4INmaFx8P3y/QPNqOkZSgIAAA==
28 | headers:
29 | allow: [OPTIONS]
30 | connection: [keep-alive]
31 | content-encoding: [gzip]
32 | content-length: ['367']
33 | content-type: [application/json]
34 | date: ['Mon, 10 Apr 2017 21:02:40 GMT']
35 | p3p: [CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"]
36 | server: [nginx/1.8.0]
37 | vary: ['Host, Cookie, Accept-Encoding']
38 | status: {code: 200, message: OK}
39 | version: 1
40 |
--------------------------------------------------------------------------------
/shippo/test/fixtures/customs-item/test_retrieve:
--------------------------------------------------------------------------------
1 | interactions:
2 | - request:
3 | body: !!python/unicode '{"origin_country": "US", "description": "T-Shirt", "quantity":
4 | 2, "mass_unit": "g", "value_currency": "USD", "net_weight": "400", "tariff_number":
5 | "", "value_amount": "20", "metadata": "Order ID #123123"}'
6 | headers:
7 | Accept: ['*/*']
8 | Accept-Encoding: ['gzip, deflate']
9 | Connection: [keep-alive]
10 | Content-Length: ['204']
11 | Content-Type: [application/json]
12 | Shippo-API-Version: ['2017-03-29']
13 | User-Agent: [Shippo/v1 PythonBindings/1.4.0]
14 | X-Shippo-Client-User-Agent: ['{"lang": "python", "publisher": "shippo", "httplib":
15 | "requests", "uname": "Darwin guozhen-shippo-mbp.local 16.4.0 Darwin Kernel
16 | Version 16.4.0: Thu Dec 22 22:53:21 PST 2016; root:xnu-3789.41.3~3/RELEASE_X86_64
17 | x86_64 i386", "lang_version": "2.7.10", "platform": "Darwin-16.4.0-x86_64-i386-64bit",
18 | "bindings_version": "1.4.0"}']
19 | method: POST
20 | uri: https://api.goshippo.com/customs/items/
21 | response:
22 | body:
23 | string: !!binary |
24 | H4sIAPDy61gC/5WQPU/DMBCG/0oUVlrZJi1NJ5C6VEJiaGFgifxxTQyNHewzFSD+O74U1IoNyYuf
25 | e+78nj9Lr55BY6MDSARTLotSMH49YdWEs63gSyaWFZvOZ7On8rL4tdNg/mHbUZS14IYtpK44rxRj
26 | qpqb2oh5rbTiQi3OGvzBQaCeNvmPDtxN62Nnh8FPte/PvIg5BXmPt3frFRUMRB3sgNY74tvJprMB
27 | qfKapEOL7xmLfHWAzQFs2yF5FWPk9DLGJjk7spbIm9wnaGTvk8PjtieqUwjgNE0sHzbj8z7Y1rpG
28 | kx5+CsRRBrvbNS716rgYwS5m0VB+l/b7DOJL+kN6QJl/WlLLfTAQivWquODiKp9xLkSKhSHB1zds
29 | r5DHywEAAA==
30 | headers:
31 | allow: [OPTIONS]
32 | connection: [keep-alive]
33 | content-encoding: [gzip]
34 | content-length: ['292']
35 | content-type: [application/json]
36 | date: ['Mon, 10 Apr 2017 21:02:40 GMT']
37 | p3p: [CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"]
38 | server: [nginx/1.8.0]
39 | vary: ['Host, Cookie, Accept-Encoding']
40 | status: {code: 201, message: CREATED}
41 | - request:
42 | body: null
43 | headers:
44 | Accept: ['*/*']
45 | Accept-Encoding: ['gzip, deflate']
46 | Connection: [keep-alive]
47 | Content-Type: [application/json]
48 | Shippo-API-Version: ['2017-03-29']
49 | User-Agent: [Shippo/v1 PythonBindings/1.4.0]
50 | X-Shippo-Client-User-Agent: ['{"lang": "python", "publisher": "shippo", "httplib":
51 | "requests", "uname": "Darwin guozhen-shippo-mbp.local 16.4.0 Darwin Kernel
52 | Version 16.4.0: Thu Dec 22 22:53:21 PST 2016; root:xnu-3789.41.3~3/RELEASE_X86_64
53 | x86_64 i386", "lang_version": "2.7.10", "platform": "Darwin-16.4.0-x86_64-i386-64bit",
54 | "bindings_version": "1.4.0"}']
55 | method: GET
56 | uri: https://api.goshippo.com/customs/items/a921d08ac4114b00b46d9d269bcb12b8
57 | response:
58 | body:
59 | string: !!binary |
60 | H4sIAPHy61gC/5WQzU7DMBCEXyUKVxrZJi1tTyD1UgmJQwsHLpF/tomhsYO9pgLEu+NNQKq4Yfni
61 | mW9WO/4svXoGjY0OIBFMuS5Kwfj1jNUzzvaCr5lY16xazOdP5WXxS6fB/IO2IyhXghu2lLrmvFaM
62 | qXphVkYsVkorLtTyLOBPDgJl2uQ/OnA3rY+dHQZfad+fcRHzFsQ93t5tN2QYiDrYAa13pO9nu84G
63 | JOc1SYcW37Ms8tMBNiewbYfE1YxVLB8Cexljk5wdjZaUN3lM0MjeJ4dT5WpCJ0OnEMBpmlw+7MY1
64 | fLCtdY2mRPgxSEcZ7OHQuNSrqSCJXcygoR4uHY9ZiC/pj9IDyvzjkiL3wUAotpvigourfMe5EGkz
65 | DAm+vgHVIZ5N0wEAAA==
66 | headers:
67 | allow: [OPTIONS]
68 | connection: [keep-alive]
69 | content-encoding: [gzip]
70 | content-length: ['298']
71 | content-type: [application/json]
72 | date: ['Mon, 10 Apr 2017 21:02:41 GMT']
73 | p3p: [CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"]
74 | server: [nginx/1.8.0]
75 | vary: ['Host, Cookie, Accept-Encoding']
76 | status: {code: 200, message: OK}
77 | version: 1
78 |
--------------------------------------------------------------------------------
/shippo/test/fixtures/manifest/test_invalid_create:
--------------------------------------------------------------------------------
1 | interactions:
2 | - request:
3 | body: !!python/unicode '{"address_from": "EXAMPLE_OF_INVALID_ADDRESS", "shipment_date":
4 | "2014-05-16T23:59:59Z", "provider": "RANDOM_INVALID_PROVIDER"}'
5 | headers:
6 | Accept: ['*/*']
7 | Accept-Encoding: ['gzip, deflate']
8 | Connection: [keep-alive]
9 | Content-Length: ['126']
10 | Content-Type: [application/json]
11 | Shippo-API-Version: ['2017-03-29']
12 | User-Agent: [Shippo/v1 PythonBindings/1.4.0]
13 | X-Shippo-Client-User-Agent: ['{"lang": "python", "publisher": "shippo", "httplib":
14 | "requests", "uname": "Darwin Thiagos-MacBook-Pro.local 16.4.0 Darwin Kernel
15 | Version 16.4.0: Thu Dec 22 22:53:21 PST 2016; root:xnu-3789.41.3~3/RELEASE_X86_64
16 | x86_64 i386", "lang_version": "2.7.10", "platform": "Darwin-16.4.0-x86_64-i386-64bit",
17 | "bindings_version": "1.4.0"}']
18 | method: POST
19 | uri: https://api.goshippo.com/manifests/
20 | response:
21 | body: {string: !!python/unicode '{"address_from": ["Address with supplied object_id
22 | not found."]}'}
23 | headers:
24 | allow: [OPTIONS]
25 | connection: [keep-alive]
26 | content-length: ['64']
27 | content-type: [application/json]
28 | date: ['Thu, 30 Mar 2017 18:40:59 GMT']
29 | p3p: [CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"]
30 | server: [nginx/1.8.0]
31 | vary: ['Host, Cookie']
32 | status: {code: 400, message: BAD REQUEST}
33 | version: 1
34 |
--------------------------------------------------------------------------------
/shippo/test/fixtures/manifest/test_invalid_retrieve:
--------------------------------------------------------------------------------
1 | interactions:
2 | - request:
3 | body: null
4 | headers:
5 | Accept: ['*/*']
6 | Accept-Encoding: ['gzip, deflate']
7 | Connection: [keep-alive]
8 | Content-Type: [application/json]
9 | Shippo-API-Version: ['2017-03-29']
10 | User-Agent: [Shippo/v1 PythonBindings/1.4.0]
11 | X-Shippo-Client-User-Agent: ['{"lang": "python", "publisher": "shippo", "httplib":
12 | "requests", "uname": "Darwin Thiagos-MacBook-Pro.local 16.4.0 Darwin Kernel
13 | Version 16.4.0: Thu Dec 22 22:53:21 PST 2016; root:xnu-3789.41.3~3/RELEASE_X86_64
14 | x86_64 i386", "lang_version": "2.7.10", "platform": "Darwin-16.4.0-x86_64-i386-64bit",
15 | "bindings_version": "1.4.0"}']
16 | method: GET
17 | uri: https://api.goshippo.com/manifests/EXAMPLE_OF_INVALID_ID
18 | response:
19 | body:
20 | string: !!binary |
21 | H4sIAAAAAAAAA7PJMLTzyy9RcMsvzUux0QfybArsQjJSFYpSC0tTi0tSUxRCg3wU9MsM9XMT8zLT
22 | gELF+q4Rjr4BPq7x/m7xnn5hjj6eLvGeLgrlicUKeUCj0kBGKeTnKZRkZBYrFKcWlaUW6dnoF9gB
23 | AAH96HpsAAAA
24 | headers:
25 | connection: [keep-alive]
26 | content-encoding: [gzip]
27 | content-length: ['123']
28 | content-type: [text/html]
29 | date: ['Thu, 30 Mar 2017 18:41:00 GMT']
30 | p3p: [CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"]
31 | server: [nginx/1.8.0]
32 | vary: ['Host, Cookie']
33 | status: {code: 404, message: NOT FOUND}
34 | version: 1
35 |
--------------------------------------------------------------------------------
/shippo/test/fixtures/manifest/test_list_all:
--------------------------------------------------------------------------------
1 | interactions:
2 | - request:
3 | body: null
4 | headers:
5 | Accept: ['*/*']
6 | Accept-Encoding: ['gzip, deflate']
7 | Connection: [keep-alive]
8 | Content-Type: [application/json]
9 | Shippo-API-Version: ['2017-03-29']
10 | User-Agent: [Shippo/v1 PythonBindings/1.4.0]
11 | X-Shippo-Client-User-Agent: ['{"lang": "python", "publisher": "shippo", "httplib":
12 | "requests", "uname": "Darwin Thiagos-MacBook-Pro.local 16.4.0 Darwin Kernel
13 | Version 16.4.0: Thu Dec 22 22:53:21 PST 2016; root:xnu-3789.41.3~3/RELEASE_X86_64
14 | x86_64 i386", "lang_version": "2.7.10", "platform": "Darwin-16.4.0-x86_64-i386-64bit",
15 | "bindings_version": "1.4.0"}']
16 | method: GET
17 | uri: https://api.goshippo.com/manifests/
18 | response:
19 | body:
20 | string: !!binary |
21 | H4sIAD1R3VgC/81WaW8TSRD9K8gSfCJOH9WXpYgNOSCQbFAOAqxQVN1dnXg38RjPOAeI/741Y3YJ
22 | xIuRgqKN8sFqVfVUvX7vVX3qpWo6anqDB1I/ftAb0VX7u3faNON6sLyM42H/pKpPh+Nx1U/V+fKF
23 | XD7H0bBQ3dTLT8Z4Qiuqx4njCV0Mq2nNyaPp2RmfTKienjXtwR+felX8k1JznCaEDeX2C0pItyT0
24 | khYH0g9ADIzvW+XftZd9iZ6O839Hh76EcDN62AVG0EJrKwzKAJRN9GiDiOR90XxgbiRUlyOatDnN
25 | 6RBPqt9u9tmG1Q02XUO9/cO1tY39/Vmf1cUwz/Km9bjuAjntnEbNcVvuN9XKA+kG2rXVeum6ajFn
26 | RqY+LhP+CscKE5UuOXGOglCSDzkYoTGqFAActDm5StP2Ax2Y/77NrNqlTGfDC5pcLxHWTb/WfTzH
27 | j9UIL+vuwRYBciyO2z7641ye7A9PRtzzhFbefTxaW9u6hmb8en16OXp6sLf5/MKF/FBt6uqhXn+0
28 | cTUech8r0igF2igTHq0e7a+mxL29pOutvLL6cmv1xbPttTWz83Z7+2jrGajV3nvuJuFkMqTJMaZ/
29 | qNdzoXjMhtBkAm0LWmldRB20FylSaEFoJjiqMTXDajTDIXswRF45LAheM2SkBYKyJmtndem9//z4
30 | wY+op+BAmIFy/N+3Xi6g3tdo39fa3KaeFAWEswbIJwgag06q6GxMsIU0X3af1Ptare1r6edSz2mv
31 | RCGGCxVkUdCA9hlAJZNIWHdX6i0CZD71Xh36zRfMs4fq6ZoS588PV3ePNq9WD8744CNW+9/TT3ob
32 | FPh7p58QyhRXRABjwIJDbSQpo5FIeYTYJqXE+KKJJiFBTikkJ4Q3NhhyFHKHcLFYrJQ2ghMAyQWl
33 | Ugmcws9mQuhifC5R58y3GwUFXaBkZXFEJggvF1JdLUlxoNQA2DrZibz5IdVvRBvRB+PmUD0VaU1R
34 | pSQBPratOCsFi5Fp5HS4R6rPqtVssVztXJon76MNEbOFxA6oojK+EOPIlsyeiHem+QIw5tO8vq4+
35 | TN3W69O3zOs3k93hdTpd270aTi4/1DvfUlx6LVTQ4i4Un0vhwszVwbqklOBRo6IFT4HBUmwJ/Ncm
36 | WQIVhHFJZA2W6VmUDigh2QTZh26gJqYtoUJFjKcNNmaO98yzKLRlYbQxLjsNyuvgJAAzOHqysjUG
37 | ndEW193j+TSAAJaDBjBMbfIEJLmGZFXsJBVYajkn9nntAREwScvPSZG/zqPItzFA6HwpRkWZwSn0
38 | XLj3yUEuyuZUOtkZNN5mpSIWIKtDkSwsyYLncexkVw8EJdEqboNrlwWCj5l4QiNqyMrKDh+rHXqv
39 | eVqn1u0wCxnIGmOJw10nXxD8Q6iiwBTGwHo0zmlHTuYSUsKF8hWyE6RqFwn2mwXy/RKtB4Llq+Rt
40 | +XIVDnnJMG1fOmYkhgoYL+6Q3/k+J9Ws2h/J11nR7kVRCZMZYsdYIy81NrHVCvbJu8p3ERjz5bt+
41 | sP7n7rtmY+P3YeN2dv+aihwPX6yPLva2vhOv62769eINhtkavGQJMO0Dc5BnYTK8EgkltPMzkkuL
42 | rFg+ykCA0UYWOrsVD370Qf8k8YQfKMVzQ/wU8dpo3QfvbxMvS6MFmwkrjFVOhZdcm9gSDPEiIqz/
43 | XxEPo+RHZeELySsMb7gZNe8ajiciCgb2rsRbBMZ84u26vcPmSr862x49i2+qnbI3ud59fvj65Fl1
44 | m3js3PqXE88ol6LI0iUiEILQ6gwy85R1wQbohj/yYiSsRDS8+PiSQxCKSmDnNELibEGIUVhyUbDl
45 | ZnZy8jF5bT0pji5ULJPz/ee/AS5wm8SgDgAA
46 | headers:
47 | allow: [OPTIONS]
48 | connection: [keep-alive]
49 | content-encoding: [gzip]
50 | content-length: ['1395']
51 | content-type: [application/json]
52 | date: ['Thu, 30 Mar 2017 18:41:01 GMT']
53 | p3p: [CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"]
54 | server: [nginx/1.8.0]
55 | vary: ['Host, Cookie, Accept-Encoding']
56 | status: {code: 200, message: OK}
57 | version: 1
58 |
--------------------------------------------------------------------------------
/shippo/test/fixtures/manifest/test_list_page_size:
--------------------------------------------------------------------------------
1 | interactions:
2 | - request:
3 | body: null
4 | headers:
5 | Accept: ['*/*']
6 | Accept-Encoding: ['gzip, deflate']
7 | Connection: [keep-alive]
8 | Content-Type: [application/json]
9 | Shippo-API-Version: ['2017-03-29']
10 | User-Agent: [Shippo/v1 PythonBindings/1.4.0]
11 | X-Shippo-Client-User-Agent: ['{"lang": "python", "publisher": "shippo", "httplib":
12 | "requests", "uname": "Darwin Thiagos-MacBook-Pro.local 16.4.0 Darwin Kernel
13 | Version 16.4.0: Thu Dec 22 22:53:21 PST 2016; root:xnu-3789.41.3~3/RELEASE_X86_64
14 | x86_64 i386", "lang_version": "2.7.10", "platform": "Darwin-16.4.0-x86_64-i386-64bit",
15 | "bindings_version": "1.4.0"}']
16 | method: GET
17 | uri: https://api.goshippo.com/manifests/?results=1
18 | response:
19 | body:
20 | string: !!binary |
21 | H4sIAD1R3VgC/4WS3W/aMBTF/5UqUnkawfFHYiOhjqUfY2Uvgw2tE4pubIdmgjiKHSit+r/PCd3E
22 | Hqa9RVfn3Ht+x3kJpGkrF4wvIvLuIqj0U/cdPDpX2/FoBHUZbox9LOvahNLsRvtotIOqLLR1dnTV
23 | aNtunZ1Egxo2eoIDv6Ju9L40rfVrqna79ZM3lR/8eAlM/lNLl8lGg9Oqu4VRlAwRGRK0jPiYojHj
24 | YYz5Q7fsTd3W6t9qEUZUnKvLXphTggiJEYNIUK1YziEWKNecF8QP2JnBHCrddB73WMLGvD8n7mTW
25 | geuBgsXXNL1ZLE6cZl+qk6+1te2F3rbTlcu6uH+ljZZRMiZJl5ZHSZ8WlPLN2Kxo/BWvRSzHpFDS
26 | ezAVheRCCYYI5FgKShPaeZSRbXegL/PPK53SDpXelnvdHIcarAstCWEHz6aCg+2f7n+FZCjrOMJa
27 | FVeLclN55kZPHp5XaTo7Uld/u24P1Yfll9uP+0SoS3xLzCW5Htw81aXnmEQMY0oYZmIwXS2mUnq2
28 | e32cqcn0fjb9dDdPU/b5+3y+mt1RPA3WnkZC05S6yUD+/gmDRBQcFNPAlKYkLiCO4iQHIghHMtei
29 | K8E1UFmQrjTVqQfFKdOa4wQKoJz4yjRBQHHMFEliUgTr1/XrL8mNWb/qAgAA
30 | headers:
31 | allow: [OPTIONS]
32 | connection: [keep-alive]
33 | content-encoding: [gzip]
34 | content-length: ['501']
35 | content-type: [application/json]
36 | date: ['Thu, 30 Mar 2017 18:41:01 GMT']
37 | p3p: [CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"]
38 | server: [nginx/1.8.0]
39 | vary: ['Host, Cookie, Accept-Encoding']
40 | status: {code: 200, message: OK}
41 | version: 1
42 |
--------------------------------------------------------------------------------
/shippo/test/fixtures/order/test_create:
--------------------------------------------------------------------------------
1 | interactions:
2 | - request:
3 | body: '{"to_address": {"city": "San Francisco", "company": "Shippo", "country":
4 | "US", "email": "shippotle@goshippo.com", "name": "Mr Hippo", "phone": "15553419393",
5 | "state": "CA", "street1": "215 Clayton St.", "zip": "94117"}, "line_items":
6 | [{"quantity": 1, "sku": "HM-123", "title": "Hippo Magazines", "total_price":
7 | "12.10", "currency": "USD", "weight": "0.40", "weight_unit": "lb"}], "placed_at":
8 | "2022-01-10T09:12:10.727100Z", "order_number": "#1068", "order_status": "PAID",
9 | "shipping_cost": "12.83", "shipping_cost_currency": "USD", "shipping_method":
10 | "USPS First Class Package", "subtotal_price": "12.10", "total_price": "24.93",
11 | "total_tax": "0.00", "currency": "USD", "weight": "0.40", "weight_unit": "lb"}'
12 | headers:
13 | Accept:
14 | - '*/*'
15 | Accept-Encoding:
16 | - gzip, deflate
17 | Connection:
18 | - keep-alive
19 | Content-Length:
20 | - '708'
21 | Content-Type:
22 | - application/json
23 | Shippo-API-Version:
24 | - '2018-02-08'
25 | User-Agent:
26 | - Shippo/v1 PythonBindings/2.0.2
27 | X-Shippo-Client-User-Agent:
28 | - '{"bindings_version": "2.0.2", "lang": "python", "publisher": "shippo", "httplib":
29 | "requests", "lang_version": "3.7.9", "platform": "Darwin-21.2.0-x86_64-i386-64bit",
30 | "uname": "Darwin Mac-mini.local 21.2.0 Darwin Kernel Version
31 | 21.2.0: Sun Nov 28 20:28:54 PST 2021; root:xnu-8019.61.5~1/RELEASE_X86_64
32 | x86_64 i386"}'
33 | method: POST
34 | uri: https://api.goshippo.com/orders/
35 | response:
36 | body:
37 | string: !!binary |
38 | H4sIAAAAAAAAA5RTy24bIRT9ldF02caCeZNVo1RRu4gUye2mVYXuALZJGJgCk6fy7wXGru2kjdQl
39 | 595zH+cennLTXwvmqeT5aZZ3uG3asu+7BpqKtDWpUblqa1x20LBVXeUfstxYLizV09ALGznvMGq6
40 | fcB58JOLgauzL58iPipgglPwESxQUZwgfILRV0ROcXGK0aIt2u+pwDyKudNzZTUxcO+v4RY+ro3b
41 | yHE0C2aGmOoNBc6tcLHT047JrAAv+Is+uE198KKqm8M+08jfzG66w+xZIESg4qTibduTiuBVxzBB
42 | /Yo0zYp0Td9EgnQ0TDkq4UWgeDuJAN6CkqGdNJqGqSfl0+DP/7e1hiGWzC9t9jniEYutQD9EeLnZ
43 | gc5bITzVJsJ7AKddcZ2dK3jwRmdLv9hHi+Pkcvdk0s/lQWcXFjSTjm27QFoxPz+Lz0c5xgepMG7n
44 | ySbtbaJ+W0ZAGb2WfuKRoyelIhQkOUbGjdGpKK7ruqwwKUkZyWIAqSI+S+KVeCVPED5oK7nQXoLa
45 | lxyEh6A97BbywvntZeIBVtYMB27aktzGjBTG8VjYOyHXm2RktKjQHqGTlglWfeoQZHLA4rljyR8/
46 | k2U9KOrhfmYjlP8BRytZ2rmoFvO2bupfhHCxwInCJmuFZltd0w9LMki9pmHTjeFz5GqZXUjrfDy2
47 | c9kVsBtYi6N0ZpIQsXZXvorQv3RSUgsqvRjSWk/Hn0M0VVGVpGoJqirU465suwIXLS857ruSpIVl
48 | uFxMTgbOLmENj6Gmy9MfsRK0p7uc3SVupkS4PMFFmvLXFLJmU+LXGr4l1PH50L8POICeVuGAkxV0
49 | 7+Odn+CeRqXCoIM4hrlQ8lbYhxchLhyzcox+2ILP0RLaBCvusw59+RsAAP//AwD2JrK0mQUAAA==
50 | headers:
51 | Connection:
52 | - keep-alive
53 | Content-Type:
54 | - application/json
55 | Date:
56 | - Mon, 10 Jan 2022 17:12:11 GMT
57 | Transfer-Encoding:
58 | - chunked
59 | allow:
60 | - OPTIONS
61 | content-encoding:
62 | - gzip
63 | content-language:
64 | - en-us
65 | p3p:
66 | - CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"
67 | server:
68 | - istio-envoy
69 | set-cookie:
70 | - tracker_sessionid=c9e0a1f10d4f4ec295a13062f98d453d; Domain=.goshippo.com;
71 | Path=/
72 | vary:
73 | - Accept-Language, Host, Cookie, Accept-Encoding
74 | x-envoy-upstream-service-time:
75 | - '120'
76 | status:
77 | code: 201
78 | message: Created
79 | version: 1
80 |
--------------------------------------------------------------------------------
/shippo/test/fixtures/order/test_invalid_create:
--------------------------------------------------------------------------------
1 | interactions:
2 | - request:
3 | body: '{}'
4 | headers:
5 | Accept:
6 | - '*/*'
7 | Accept-Encoding:
8 | - gzip, deflate
9 | Connection:
10 | - keep-alive
11 | Content-Length:
12 | - '2'
13 | Content-Type:
14 | - application/json
15 | Shippo-API-Version:
16 | - '2018-02-08'
17 | User-Agent:
18 | - Shippo/v1 PythonBindings/2.0.2
19 | X-Shippo-Client-User-Agent:
20 | - '{"bindings_version": "2.0.2", "lang": "python", "publisher": "shippo", "httplib":
21 | "requests", "lang_version": "3.7.9", "platform": "Darwin-21.2.0-x86_64-i386-64bit",
22 | "uname": "Darwin Mac-mini.local 21.2.0 Darwin Kernel Version
23 | 21.2.0: Sun Nov 28 20:28:54 PST 2021; root:xnu-8019.61.5~1/RELEASE_X86_64
24 | x86_64 i386"}'
25 | method: POST
26 | uri: https://api.goshippo.com/orders/
27 | response:
28 | body:
29 | string: !!binary |
30 | H4sIAAAAAAAAA6pWKshJTE5NiU8sUbJSiFYKycgsVkjLTM1JUQAyilILSzOLUlP0lGJ1FJRK8uMT
31 | U1KKUouLCSotT81MzyiJL83LJGwsRC1+ZbUAAAAA//8DADERpouoAAAA
32 | headers:
33 | Connection:
34 | - keep-alive
35 | Content-Type:
36 | - application/json
37 | Date:
38 | - Mon, 10 Jan 2022 17:18:42 GMT
39 | Transfer-Encoding:
40 | - chunked
41 | allow:
42 | - OPTIONS
43 | content-encoding:
44 | - gzip
45 | content-language:
46 | - en-us
47 | p3p:
48 | - CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"
49 | server:
50 | - istio-envoy
51 | set-cookie:
52 | - tracker_sessionid=f7b4524436b842528dcd5b97a348a906; Domain=.goshippo.com;
53 | Path=/
54 | vary:
55 | - Accept-Language, Host, Cookie, Accept-Encoding
56 | x-envoy-upstream-service-time:
57 | - '19'
58 | status:
59 | code: 400
60 | message: Bad Request
61 | version: 1
62 |
--------------------------------------------------------------------------------
/shippo/test/fixtures/order/test_invalid_retrieve:
--------------------------------------------------------------------------------
1 | interactions:
2 | - request:
3 | body: null
4 | headers:
5 | Accept:
6 | - '*/*'
7 | Accept-Encoding:
8 | - gzip, deflate
9 | Connection:
10 | - keep-alive
11 | Content-Type:
12 | - application/json
13 | Shippo-API-Version:
14 | - '2018-02-08'
15 | User-Agent:
16 | - Shippo/v1 PythonBindings/2.0.2
17 | X-Shippo-Client-User-Agent:
18 | - '{"bindings_version": "2.0.2", "lang": "python", "publisher": "shippo", "httplib":
19 | "requests", "lang_version": "3.7.9", "platform": "Darwin-21.2.0-x86_64-i386-64bit",
20 | "uname": "Darwin Mac-mini.local 21.2.0 Darwin Kernel Version
21 | 21.2.0: Sun Nov 28 20:28:54 PST 2021; root:xnu-8019.61.5~1/RELEASE_X86_64
22 | x86_64 i386"}'
23 | method: GET
24 | uri: https://api.goshippo.com/orders/EXAMPLE_OF_INVALID_ID
25 | response:
26 | body:
27 | string: !!binary |
28 | H4sIAAAAAAAAA7LJMLTzyy9RcMsvzUux0QfybArsQjJSFYpSC0tTi0tSUxRCg3wU9POLUlKLivVd
29 | Ixx9A3xc4/3d4j39whx9PF3iPV0UyhOLFfKAhqSBDFHIz1MoycgsVihOLSpLLdKz0S+wAwAAAP//
30 | AwDIFUFIZgAAAA==
31 | headers:
32 | Connection:
33 | - keep-alive
34 | Content-Type:
35 | - text/html
36 | Date:
37 | - Mon, 10 Jan 2022 17:18:42 GMT
38 | Transfer-Encoding:
39 | - chunked
40 | content-encoding:
41 | - gzip
42 | content-language:
43 | - en-us
44 | p3p:
45 | - CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"
46 | server:
47 | - istio-envoy
48 | set-cookie:
49 | - tracker_sessionid=dd7c011d9c9d400dabcc3d41d3b6b89a; Domain=.goshippo.com;
50 | Path=/
51 | vary:
52 | - Accept-Language, Host, Cookie, Accept-Encoding
53 | x-envoy-upstream-service-time:
54 | - '8'
55 | status:
56 | code: 404
57 | message: Not Found
58 | version: 1
59 |
--------------------------------------------------------------------------------
/shippo/test/fixtures/order/test_list_all:
--------------------------------------------------------------------------------
1 | interactions:
2 | - request:
3 | body: null
4 | headers:
5 | Accept:
6 | - '*/*'
7 | Accept-Encoding:
8 | - gzip, deflate
9 | Connection:
10 | - keep-alive
11 | Content-Type:
12 | - application/json
13 | Shippo-API-Version:
14 | - '2018-02-08'
15 | User-Agent:
16 | - Shippo/v1 PythonBindings/2.0.2
17 | X-Shippo-Client-User-Agent:
18 | - '{"bindings_version": "2.0.2", "lang": "python", "publisher": "shippo", "httplib":
19 | "requests", "lang_version": "3.7.9", "platform": "Darwin-21.2.0-x86_64-i386-64bit",
20 | "uname": "Darwin Mac-mini.local 21.2.0 Darwin Kernel Version
21 | 21.2.0: Sun Nov 28 20:28:54 PST 2021; root:xnu-8019.61.5~1/RELEASE_X86_64
22 | x86_64 i386"}'
23 | method: GET
24 | uri: https://api.goshippo.com/orders/
25 | response:
26 | body:
27 | string: !!binary |
28 | H4sIAAAAAAAAA7xU227cNhD9FUF9bHdBStSFfmqQImhR2DXgBAVaBAJFjnaZSJRKUo4dw/8eklpZ
29 | 0Xod10XbR565nxmeu1jBjY3PIjW27Q9RPGi4lv1oFkSDGVvrgT/v4r7+ANxWUrhnXOIiL9K6LnOW
30 | E1pkNENpU2Q4LVnOm4zELrrXAnSlxq4G7WO+wygvF4OxzIZi8eWrX37y+NAyDqJivqc4QUmyQXiD
31 | 0VtEz3ByhtG2SIo/QoKplf6TmjK3I2fm+w/smv24681eDkO/5X3nXW1fMSHcIL7SwxBcA7Mgjurg
32 | ItTBW5LlX9cZB/EC74kgRBkRlIiiqCmhuCk5pqhuaJ43tMzr3AdIU7kuhxYsuBCrR3DgNWulKyd7
33 | VS30392/bGrFOp8yPtfRzx73mC/F1K2Hr/YzaKwGsJXqPbwAOMyKs+h1y25tr6Iru12sydo5nZ9c
34 | 2ik9U9EbzRSXhh+qsDBi/PqVf36Wg39QgnExdTYqq0PouysPtL3aSTsKWE6xdZSskWHfq5AUZ1mW
35 | EkxTmvpg6JhsPT5RYlt4RI8j3nErBSgrWbuk7MAyxz2bB7Jg7GEzfgGN7ruvrukQZPb9ULFhWBP7
36 | CeRuHw4ZbQlakGpUMsBtHSo4mgzjft3hm70PJ2tZW1l2M0UjFD+Ag5Y8zJyQ7TStGesjE062OITw
37 | UWtQ/MBr+GGBBql2lZt034vJcnkVvZHaWL9sY6JLxj+yHazceR+I8LnL9JGlOlGplQoqaaE7pR6Q
38 | k4SklBQUEYJqXKZFmeCkEKnAdZnSMLB0m/PO4YCjc7Zjn11OE4c/oiVTtpp95k18HEPA+QYnocu/
39 | Ruc1HSV+zOG3iFqvDz29wI6psXELHDVUyx3P98RuKs+Ua7SDNSygldegb49MAgzXcvD3cADv/Umo
40 | 3p3i4rW+yyNyc9zgJMvLtCYFKQHVCFGOoSgwcMZEfUKaD2mPdfndxa8Xv/1+cUKacbZB5SYhb1Hm
41 | RTBD2yQn/4E0n6iT4Sel+VnviSAqMEaJwLSoS9I0nCYAOeWoLFGW8Yb+P9IcdriW5WcFOUMo6qQx
42 | roNoin5SkA8rnSXZOElu/p4ko39Bklc6/A0yXijE4T/8UyE+eK1/8fyhnpHh2W0lIHPZYwWeqV9U
43 | 5aHBY/U9Nhx09hRcPc631tindaJhrYH79/dfAAAA//8DAOp+MWbxCQAA
44 | headers:
45 | Connection:
46 | - keep-alive
47 | Content-Type:
48 | - application/json
49 | Date:
50 | - Mon, 10 Jan 2022 17:18:43 GMT
51 | Transfer-Encoding:
52 | - chunked
53 | allow:
54 | - OPTIONS
55 | content-encoding:
56 | - gzip
57 | content-language:
58 | - en-us
59 | p3p:
60 | - CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"
61 | server:
62 | - istio-envoy
63 | set-cookie:
64 | - tracker_sessionid=09684e9663cc4ba3829b3f7c915b3ea9; Domain=.goshippo.com;
65 | Path=/
66 | vary:
67 | - Accept-Language, Host, Cookie, Accept-Encoding
68 | x-envoy-upstream-service-time:
69 | - '113'
70 | status:
71 | code: 200
72 | message: OK
73 | version: 1
74 |
--------------------------------------------------------------------------------
/shippo/test/fixtures/order/test_list_page_size:
--------------------------------------------------------------------------------
1 | interactions:
2 | - request:
3 | body: null
4 | headers:
5 | Accept:
6 | - '*/*'
7 | Accept-Encoding:
8 | - gzip, deflate
9 | Connection:
10 | - keep-alive
11 | Content-Type:
12 | - application/json
13 | Shippo-API-Version:
14 | - '2018-02-08'
15 | User-Agent:
16 | - Shippo/v1 PythonBindings/2.0.2
17 | X-Shippo-Client-User-Agent:
18 | - '{"bindings_version": "2.0.2", "lang": "python", "publisher": "shippo", "httplib":
19 | "requests", "lang_version": "3.7.9", "platform": "Darwin-21.2.0-x86_64-i386-64bit",
20 | "uname": "Darwin Mac-mini.local 21.2.0 Darwin Kernel Version
21 | 21.2.0: Sun Nov 28 20:28:54 PST 2021; root:xnu-8019.61.5~1/RELEASE_X86_64
22 | x86_64 i386"}'
23 | method: GET
24 | uri: https://api.goshippo.com/orders/?results=1
25 | response:
26 | body:
27 | string: !!binary |
28 | H4sIAAAAAAAAA5RUW2vbMBj9K8aDvWxNJN9dKFvpKNtDoZDtZaOIz7KSqJUlT5KzXuh/nyQnddJ2
29 | gz76fNdzviM/xJLd2vg4itfW9sfzOfR8tlJmzftezajq5kq3TJv5J83MIKw5we97WLGTJP4Yxb1m
30 | G64G4+rlIIRDtlkO+PUQq+aaUUt46/tXuCzKtGmqAoqsLvM6R+myzHFaQUGXeeb7hVlEDl3DtK95
31 | h1FRTQFjwYZh8eXpty9hAQGUtQQCgwQlyRHCRxh9R/UxTo4xmpVJ+TM0GFdRf+TYWQwUzIdr2MDn
32 | fbY+1SoCbeuI+ElPJKhmYFn7bA4uwxw8y/Jif87Qt2/IHgVCNWRtnbVl2dRZjZcVxTVqlnVRLOuq
33 | aApfwA1xW/aCWeZKrB6YAzcguBvHlSST/A+Pb2MtofMt4wsdffW4x/wokHceXqx3oLGaMUuk8vAE
34 | 4MAV59GZgDurZLSwsymaHCanu0/K7dgeZHSuQVJu6HYKBIrx2an/vOe9/6gzjMtxs0FaHUp/LDwg
35 | lFxxO7RssqJwkhwi/VrJ0BTneZ5muE7r1BezDrjw+CiJFeyFPE54py1vmbQcxNSyYxac9rAjZJmx
36 | 28v4Ayy16vbctC0ya9UT6PtDYf8wvloHI6NZhiaEDJIHWDRhgpPJAPXnDs/sKljWgiAWbsdqhOIn
37 | sNecBs5JNhvZmqF5FsLJDIcSOmjNJN3qGl5YkIHLFXFM16odI5eL6JxrY/2xjYkugd64f8JBOlVB
38 | CN+7Sl9EyCuTBJeMcMu61/4erMiSLK2zskZZhhpcpWWV4KRs0xY3VVoHwtxdzicHA0cXsIJ719PE
39 | 4Y1oDtKSXc7uEjdDKLg4wknY8vfgskZT4pca/k+ow/Ohfx+wAzks3QEHzcjk452f4JZ4pdyiHTuE
40 | Wyb4hum7Z6GWGap57/2wBR+9JaRyVpyy9n159fgXAAD//wMAGs2oyfYFAAA=
41 | headers:
42 | Connection:
43 | - keep-alive
44 | Content-Type:
45 | - application/json
46 | Date:
47 | - Mon, 10 Jan 2022 17:18:44 GMT
48 | Transfer-Encoding:
49 | - chunked
50 | allow:
51 | - OPTIONS
52 | content-encoding:
53 | - gzip
54 | content-language:
55 | - en-us
56 | p3p:
57 | - CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"
58 | server:
59 | - istio-envoy
60 | set-cookie:
61 | - tracker_sessionid=70add1706dde4b5abfa043ea91c8a66f; Domain=.goshippo.com;
62 | Path=/
63 | vary:
64 | - Accept-Language, Host, Cookie, Accept-Encoding
65 | x-envoy-upstream-service-time:
66 | - '73'
67 | status:
68 | code: 200
69 | message: OK
70 | version: 1
71 |
--------------------------------------------------------------------------------
/shippo/test/fixtures/parcel/test_create:
--------------------------------------------------------------------------------
1 | interactions:
2 | - request:
3 | body: !!python/unicode '{"weight": "2", "distance_unit": "cm", "mass_unit": "lb",
4 | "height": "5", "width": "5", "length": "5", "template": "", "metadata": "Customer
5 | ID 123456"}'
6 | headers:
7 | Accept: ['*/*']
8 | Accept-Encoding: ['gzip, deflate']
9 | Connection: [keep-alive]
10 | Content-Length: ['151']
11 | Content-Type: [application/json]
12 | Shippo-API-Version: ['2017-03-29']
13 | User-Agent: [Shippo/v1 PythonBindings/1.4.0]
14 | X-Shippo-Client-User-Agent: ['{"lang": "python", "publisher": "shippo", "httplib":
15 | "requests", "uname": "Darwin guozhen-shippo-mbp.local 16.4.0 Darwin Kernel
16 | Version 16.4.0: Thu Dec 22 22:53:21 PST 2016; root:xnu-3789.41.3~3/RELEASE_X86_64
17 | x86_64 i386", "lang_version": "2.7.10", "platform": "Darwin-16.4.0-x86_64-i386-64bit",
18 | "bindings_version": "1.4.0"}']
19 | method: POST
20 | uri: https://api.goshippo.com/parcels/
21 | response:
22 | body:
23 | string: !!binary |
24 | H4sIAAjz61gC/5WQS0/DMBCE/0qUM63sOA8lJxC9VOKIOIBQ5DjbxMiPyA8CVP3v2KlIc+W4M9/s
25 | avac6u4DmGutow7SJklfHp6Oh/Qu+TOYgeD00coQrnYo32H0nOEGkQbl+6ooXze0n/p/0HwBaded
26 | yhrXdQGQYwKUMJJTXDFC6gKVsAnoWYGJmcHrnxHU/aDtyKdJ75mWkXMgJ3FtorwQQRGgBjfGTBGB
27 | mfebaQQ+jG4dex7eoBi0XvFFZcvSeaWyOEpq7UqILkqfVHhoqdReudvpq8q8MaDY902X4Gh4E435
28 | R2+dlmCS4yHBGcmLMu6DL2eifb7EBlxBy0MzG5S396WljWec8XD5BW8qdQrCAQAA
29 | headers:
30 | allow: [OPTIONS]
31 | connection: [keep-alive]
32 | content-encoding: [gzip]
33 | content-length: ['276']
34 | content-type: [application/json]
35 | date: ['Mon, 10 Apr 2017 21:03:04 GMT']
36 | p3p: [CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"]
37 | server: [nginx/1.8.0]
38 | vary: ['Host, Cookie, Accept-Encoding']
39 | status: {code: 201, message: CREATED}
40 | version: 1
41 |
--------------------------------------------------------------------------------
/shippo/test/fixtures/parcel/test_invalid_create:
--------------------------------------------------------------------------------
1 | interactions:
2 | - request:
3 | body: !!python/unicode '{"weight": "2", "distance_unit": "cm", "width": "5", "length":
4 | "5", "template": "", "metadata": "Customer ID 123456"}'
5 | headers:
6 | Accept: ['*/*']
7 | Accept-Encoding: ['gzip, deflate']
8 | Connection: [keep-alive]
9 | Content-Length: ['117']
10 | Content-Type: [application/json]
11 | Shippo-API-Version: ['2017-03-29']
12 | User-Agent: [Shippo/v1 PythonBindings/1.4.0]
13 | X-Shippo-Client-User-Agent: ['{"lang": "python", "publisher": "shippo", "httplib":
14 | "requests", "uname": "Darwin guozhen-shippo-mbp.local 16.4.0 Darwin Kernel
15 | Version 16.4.0: Thu Dec 22 22:53:21 PST 2016; root:xnu-3789.41.3~3/RELEASE_X86_64
16 | x86_64 i386", "lang_version": "2.7.10", "platform": "Darwin-16.4.0-x86_64-i386-64bit",
17 | "bindings_version": "1.4.0"}']
18 | method: POST
19 | uri: https://api.goshippo.com/parcels/
20 | response:
21 | body: {string: !!python/unicode '{"mass_unit": ["This field is required."]}'}
22 | headers:
23 | allow: [OPTIONS]
24 | connection: [keep-alive]
25 | content-length: ['42']
26 | content-type: [application/json]
27 | date: ['Mon, 10 Apr 2017 21:03:05 GMT']
28 | p3p: [CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"]
29 | server: [nginx/1.8.0]
30 | vary: ['Host, Cookie']
31 | status: {code: 400, message: BAD REQUEST}
32 | version: 1
33 |
--------------------------------------------------------------------------------
/shippo/test/fixtures/parcel/test_invalid_retrieve:
--------------------------------------------------------------------------------
1 | interactions:
2 | - request:
3 | body: null
4 | headers:
5 | Accept: ['*/*']
6 | Accept-Encoding: ['gzip, deflate']
7 | Connection: [keep-alive]
8 | Content-Type: [application/json]
9 | Shippo-API-Version: ['2017-03-29']
10 | User-Agent: [Shippo/v1 PythonBindings/1.4.0]
11 | X-Shippo-Client-User-Agent: ['{"lang": "python", "publisher": "shippo", "httplib":
12 | "requests", "uname": "Darwin guozhen-shippo-mbp.local 16.4.0 Darwin Kernel
13 | Version 16.4.0: Thu Dec 22 22:53:21 PST 2016; root:xnu-3789.41.3~3/RELEASE_X86_64
14 | x86_64 i386", "lang_version": "2.7.10", "platform": "Darwin-16.4.0-x86_64-i386-64bit",
15 | "bindings_version": "1.4.0"}']
16 | method: GET
17 | uri: https://api.goshippo.com/parcels/EXAMPLE_OF_INVALID_ID
18 | response:
19 | body:
20 | string: !!binary |
21 | H4sIAAAAAAAAA7PJMLTzyy9RcMsvzUux0QfybArsQjJSFYpSC0tTi0tSUxRCg3wU9MsM9QsSi5JT
22 | c4r1XSMcfQN8XOP93eI9/cIcfTxd4j1dFMoTixXygAalgQxSyM9TKMnILFYoTi0qSy3Ss9EvsAMA
23 | Vp5PvWoAAAA=
24 | headers:
25 | connection: [keep-alive]
26 | content-encoding: [gzip]
27 | content-length: ['122']
28 | content-type: [text/html]
29 | date: ['Mon, 10 Apr 2017 21:03:05 GMT']
30 | p3p: [CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"]
31 | server: [nginx/1.8.0]
32 | vary: ['Host, Cookie']
33 | status: {code: 404, message: NOT FOUND}
34 | version: 1
35 |
--------------------------------------------------------------------------------
/shippo/test/fixtures/parcel/test_list_all:
--------------------------------------------------------------------------------
1 | interactions:
2 | - request:
3 | body: null
4 | headers:
5 | Accept: ['*/*']
6 | Accept-Encoding: ['gzip, deflate']
7 | Connection: [keep-alive]
8 | Content-Type: [application/json]
9 | Shippo-API-Version: ['2017-03-29']
10 | User-Agent: [Shippo/v1 PythonBindings/1.4.0]
11 | X-Shippo-Client-User-Agent: ['{"lang": "python", "publisher": "shippo", "httplib":
12 | "requests", "uname": "Darwin guozhen-shippo-mbp.local 16.4.0 Darwin Kernel
13 | Version 16.4.0: Thu Dec 22 22:53:21 PST 2016; root:xnu-3789.41.3~3/RELEASE_X86_64
14 | x86_64 i386", "lang_version": "2.7.10", "platform": "Darwin-16.4.0-x86_64-i386-64bit",
15 | "bindings_version": "1.4.0"}']
16 | method: GET
17 | uri: https://api.goshippo.com/parcels/
18 | response:
19 | body:
20 | string: !!binary |
21 | H4sIAAvz61gC/+2VS4/TMBSF/0qVNZNev+NICBCzGYklYgEaVbZz2wTlpcRpgWr+O3ZalcLMoiOk
22 | rppdzj0nzvGnOPvEdVPrk3xBJIg3i6TFH/EuKb3vx3y5NH2VbrqxrPq+S13XLLdk2ZvBYT0u3/Vm
23 | g29pEmL9gNuqm8YQbae6DsqA41T7KHzbJ539js6vRm88xqd/+fDp4T7mjgM3YJgUcUSBqDvgdwQ+
24 | U5IDy4GnSsivZ+6pL17hrmajsXYtNdFaIHLC0DDHuCHKMaYFSDwLdLsWh5jZTN2vEtv35/2jz2PT
25 | 14cmx7I1thtfxoxIIVzRtauKf6USq03p/9aKKuxK63A1tdU8cvMau5OVnqyNGceTrbZR2pp6wpVp
26 | jhCPr3NQ3TQM2Lqff/QGvQlbZ2L+4zT6rsFh8XC/IJRxIePzAv0hjvdPsVXV4qoKbWeKj3PzMS7j
27 | hwmD4X+40lyoFOSFXGe3Yi9wlUZZnnGALHRYAzeaOZRra4FTyFDeuF6bK2cpAX0p1+DOiHjOlUhq
28 | jSOFtZxy0KAdMcpZZTgtMgbsxvXaXEGmGuilXEGlQtHnXIvwWSpbCE0I4USsLc0kR4Vrhk46J25c
29 | r8gVcqFzFrjS7AKuB3fgql84h8NPlDoGXBpJeZahEcgYLUCFQxgl4Teur+X6+PQbT6jpa50JAAA=
30 | headers:
31 | allow: [OPTIONS]
32 | connection: [keep-alive]
33 | content-encoding: [gzip]
34 | content-length: ['512']
35 | content-type: [application/json]
36 | date: ['Mon, 10 Apr 2017 21:03:07 GMT']
37 | p3p: [CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"]
38 | server: [nginx/1.8.0]
39 | vary: ['Host, Cookie, Accept-Encoding']
40 | status: {code: 200, message: OK}
41 | version: 1
42 |
--------------------------------------------------------------------------------
/shippo/test/fixtures/parcel/test_list_page_size:
--------------------------------------------------------------------------------
1 | interactions:
2 | - request:
3 | body: null
4 | headers:
5 | Accept: ['*/*']
6 | Accept-Encoding: ['gzip, deflate']
7 | Connection: [keep-alive]
8 | Content-Type: [application/json]
9 | Shippo-API-Version: ['2017-03-29']
10 | User-Agent: [Shippo/v1 PythonBindings/1.4.0]
11 | X-Shippo-Client-User-Agent: ['{"lang": "python", "publisher": "shippo", "httplib":
12 | "requests", "uname": "Darwin guozhen-shippo-mbp.local 16.4.0 Darwin Kernel
13 | Version 16.4.0: Thu Dec 22 22:53:21 PST 2016; root:xnu-3789.41.3~3/RELEASE_X86_64
14 | x86_64 i386", "lang_version": "2.7.10", "platform": "Darwin-16.4.0-x86_64-i386-64bit",
15 | "bindings_version": "1.4.0"}']
16 | method: GET
17 | uri: https://api.goshippo.com/parcels/?results=2
18 | response:
19 | body:
20 | string: !!binary |
21 | H4sIAAvz61gC/+2SP2/bMBDFv4qhoVMjkSJFWQKCtmiWAB2DDikCg6LPEguJJPjHbmrku4dUBMcN
22 | MtToWm1697s7vXs6ZkIH5bN2hRmqPq4yBb/SWzZ4b1xbFNzIvNdukMboXOip2OPCcCtgdMUnCy6M
23 | 3l2XHwzv4brM4gBjYS91cHGICuMYlYWKwo9jprufIPzGee4h7fn+5dvtTepbCsJCrGxTqUS4vkL0
24 | CqO7EreItIjmdcXuz+hgthfQcgZ51+1Yg5umAqCYACeCUI5rQUhTIQZnDfqgwKaePujfA6jP55dI
25 | nIfJjC9OFrMjqN4PqafKUXwSdZDbt9IAsh/8n9pWxqsoAZug5FwS847DCS1P6MSdO2Fjl6Q9HwNs
26 | +LTEuXzOiyqCtaDE46s+gefxdDz1fw3O6wns6vZmhUtCK5bmxf/ApvLxKbmSCjYyup1TfJidu7TG
27 | 2wAR+Jdcy7aqc8T+MteZrsk7uTJed3RNEVpHDztEeUMEsF3XIVqiNbD/uV6a68PTMzX6GQ4fBAAA
28 | headers:
29 | allow: [OPTIONS]
30 | connection: [keep-alive]
31 | content-encoding: [gzip]
32 | content-length: ['399']
33 | content-type: [application/json]
34 | date: ['Mon, 10 Apr 2017 21:03:07 GMT']
35 | p3p: [CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"]
36 | server: [nginx/1.8.0]
37 | vary: ['Host, Cookie, Accept-Encoding']
38 | status: {code: 200, message: OK}
39 | version: 1
40 |
--------------------------------------------------------------------------------
/shippo/test/fixtures/parcel/test_retrieve:
--------------------------------------------------------------------------------
1 | interactions:
2 | - request:
3 | body: !!python/unicode '{"weight": "2", "distance_unit": "cm", "mass_unit": "lb",
4 | "height": "5", "width": "5", "length": "5", "template": "", "metadata": "Customer
5 | ID 123456"}'
6 | headers:
7 | Accept: ['*/*']
8 | Accept-Encoding: ['gzip, deflate']
9 | Connection: [keep-alive]
10 | Content-Length: ['151']
11 | Content-Type: [application/json]
12 | Shippo-API-Version: ['2017-03-29']
13 | User-Agent: [Shippo/v1 PythonBindings/1.4.0]
14 | X-Shippo-Client-User-Agent: ['{"lang": "python", "publisher": "shippo", "httplib":
15 | "requests", "uname": "Darwin guozhen-shippo-mbp.local 16.4.0 Darwin Kernel
16 | Version 16.4.0: Thu Dec 22 22:53:21 PST 2016; root:xnu-3789.41.3~3/RELEASE_X86_64
17 | x86_64 i386", "lang_version": "2.7.10", "platform": "Darwin-16.4.0-x86_64-i386-64bit",
18 | "bindings_version": "1.4.0"}']
19 | method: POST
20 | uri: https://api.goshippo.com/parcels/
21 | response:
22 | body:
23 | string: !!binary |
24 | H4sIAAzz61gC/5WQS0/DMBCE/0qUM61sJ6FRT0X0Uokj4gBCkWNvEiM/Ij8IUPW/Y6cizZXjznyz
25 | q9lzbtoPYL5xnnrI91n+8vB0OuZ32Z/BLESHJ4sgvNugcoPRM8F7VOxRvS0Ifl3RYeT/oMUM1oRg
26 | XpKuBVyViKK26wjhqOrIjpOu5quAmTTYlOmD+RlAH3rjBjGOZsuMSpwHNcprEx2kjIoE3fshZaoE
27 | TIKvpgFEP/hl5CK+QTNoghazyual00KRNCrq3ELINkmfVAZoqDJB+9vpq8qCtaDZ901X4Gl8E035
28 | x+C8UWCz0zHDpCir+7QPvrxN9vmSGggNjYjNXFTe3ueWLp3xNsDlF/+bvx/CAQAA
29 | headers:
30 | allow: [OPTIONS]
31 | connection: [keep-alive]
32 | content-encoding: [gzip]
33 | content-length: ['276']
34 | content-type: [application/json]
35 | date: ['Mon, 10 Apr 2017 21:03:08 GMT']
36 | p3p: [CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"]
37 | server: [nginx/1.8.0]
38 | vary: ['Host, Cookie, Accept-Encoding']
39 | status: {code: 201, message: CREATED}
40 | - request:
41 | body: null
42 | headers:
43 | Accept: ['*/*']
44 | Accept-Encoding: ['gzip, deflate']
45 | Connection: [keep-alive]
46 | Content-Type: [application/json]
47 | Shippo-API-Version: ['2017-03-29']
48 | User-Agent: [Shippo/v1 PythonBindings/1.4.0]
49 | X-Shippo-Client-User-Agent: ['{"lang": "python", "publisher": "shippo", "httplib":
50 | "requests", "uname": "Darwin guozhen-shippo-mbp.local 16.4.0 Darwin Kernel
51 | Version 16.4.0: Thu Dec 22 22:53:21 PST 2016; root:xnu-3789.41.3~3/RELEASE_X86_64
52 | x86_64 i386", "lang_version": "2.7.10", "platform": "Darwin-16.4.0-x86_64-i386-64bit",
53 | "bindings_version": "1.4.0"}']
54 | method: GET
55 | uri: https://api.goshippo.com/parcels/8221d42fbe1540a0bff22d05f27d2f8d
56 | response:
57 | body:
58 | string: !!binary |
59 | H4sIAAzz61gC/5WQzU7DMBCEXyXKmUa2k9AoJxC9VOKIOIBQ5NibxCi2I/8QoOq7Y6ciLdzq48w3
60 | 3p09pLp9B+Ya66iDtE7S5/vH/S69SX4NZiA4PFoE4e0GFRuMngiuUV6jKssJfrmg/cSvoMUCVoRg
61 | XpCuBVwWiKK26wjhqOzIlpOu4hcBPSswMdN7/T2Auuu1HcQ06YxpGTkHchpPTZQfx6CMoHo3xEyZ
62 | ofAiNQv+XxpA9IP7q3ERrqIYNF6JxWLLjHlFyYpKau2KjW2UPujooaFSe+XO65xU5o0Bxb7OugRH
63 | w+lozD9467QEk+x3CSZ5Ud7G/+DTmWgfjrGVUNCI0NYG5fVtaW7jGGc8HH8AXC3q7NYBAAA=
64 | headers:
65 | allow: [OPTIONS]
66 | connection: [keep-alive]
67 | content-encoding: [gzip]
68 | content-length: ['281']
69 | content-type: [application/json]
70 | date: ['Mon, 10 Apr 2017 21:03:08 GMT']
71 | p3p: [CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"]
72 | server: [nginx/1.8.0]
73 | vary: ['Host, Cookie, Accept-Encoding']
74 | status: {code: 200, message: OK}
75 | version: 1
76 |
--------------------------------------------------------------------------------
/shippo/test/fixtures/rate/test_invalid_retrieve:
--------------------------------------------------------------------------------
1 | interactions:
2 | - request:
3 | body: null
4 | headers:
5 | Accept: ['*/*']
6 | Accept-Encoding: ['gzip, deflate']
7 | Connection: [keep-alive]
8 | Content-Type: [application/json]
9 | Shippo-API-Version: ['2017-03-29']
10 | User-Agent: [Shippo/v1 PythonBindings/1.4.0]
11 | X-Shippo-Client-User-Agent: ['{"lang": "python", "publisher": "shippo", "httplib":
12 | "requests", "uname": "Darwin guozhen-shippo-mbp.local 16.4.0 Darwin Kernel
13 | Version 16.4.0: Thu Dec 22 22:53:21 PST 2016; root:xnu-3789.41.3~3/RELEASE_X86_64
14 | x86_64 i386", "lang_version": "2.7.10", "platform": "Darwin-16.4.0-x86_64-i386-64bit",
15 | "bindings_version": "1.4.0"}']
16 | method: GET
17 | uri: https://api.goshippo.com/rates/EXAMPLE_OF_INVALID_ID
18 | response:
19 | body:
20 | string: !!binary |
21 | H4sIAAAAAAAAAxXMQQqDMBAF0Kv8E3RwHwKCCoHUlqLSXRCckm4SzSR6fXX5Nk/5Svcxo4slLIou
22 | qVUPnpF4KyyZF4wfC9orSnNmofZbP9+2da/OmX6qrWmcaXDMgnA1v7tBDMj+LxBOO6eHolWf8hqv
23 | SWgAAAA=
24 | headers:
25 | connection: [keep-alive]
26 | content-encoding: [gzip]
27 | content-length: ['119']
28 | content-type: [text/html]
29 | date: ['Mon, 10 Apr 2017 21:03:09 GMT']
30 | p3p: [CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"]
31 | server: [nginx/1.8.0]
32 | vary: ['Host, Cookie']
33 | status: {code: 404, message: NOT FOUND}
34 | version: 1
35 |
--------------------------------------------------------------------------------
/shippo/test/fixtures/shipment/test_invalid_create:
--------------------------------------------------------------------------------
1 | interactions:
2 | - request:
3 | body: !!python/unicode '{"customs_declaration": "b741b99f95e841639b54272834bc478c",
4 | "address_from": "4f406a13253945a8bc8deb0f8266b245", "extra": {"signature_confirmation":
5 | true, "reference_1": "", "insurance": {"currency": "USD", "amount": "200"},
6 | "reference_2": ""}, "shipment_date": "2017-03-31T17:37:59.817Z", "submission_type":
7 | "PICKUP", "metadata": "Customer ID 123456"}'
8 | headers:
9 | Accept: ['*/*']
10 | Accept-Encoding: ['gzip, deflate']
11 | Connection: [keep-alive]
12 | Content-Length: ['351']
13 | Content-Type: [application/json]
14 | Shippo-API-Version: ['2017-03-29']
15 | User-Agent: [Shippo/v1 PythonBindings/1.4.0]
16 | X-Shippo-Client-User-Agent: ['{"lang": "python", "publisher": "shippo", "httplib":
17 | "requests", "uname": "Darwin guozhen-shippo-mbp.local 16.4.0 Darwin Kernel
18 | Version 16.4.0: Thu Dec 22 22:53:21 PST 2016; root:xnu-3789.41.3~3/RELEASE_X86_64
19 | x86_64 i386", "lang_version": "2.7.10", "platform": "Darwin-16.4.0-x86_64-i386-64bit",
20 | "bindings_version": "1.4.0"}']
21 | method: POST
22 | uri: https://api.goshippo.com/shipments/
23 | response:
24 | body: {string: !!python/unicode '{"customs_declaration": ["CustomsDeclaration
25 | with supplied object_id b741b99f95e841639b54272834bc478c not found."], "parcels":
26 | ["This field is required."], "address_to": ["This field is required."]}'}
27 | headers:
28 | allow: [OPTIONS]
29 | connection: [keep-alive]
30 | content-length: ['198']
31 | content-type: [application/json]
32 | date: ['Mon, 10 Apr 2017 21:03:41 GMT']
33 | p3p: [CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"]
34 | server: [nginx/1.8.0]
35 | vary: ['Host, Cookie']
36 | status: {code: 400, message: BAD REQUEST}
37 | version: 1
38 |
--------------------------------------------------------------------------------
/shippo/test/fixtures/shipment/test_invalid_get_rate:
--------------------------------------------------------------------------------
1 | interactions:
2 | - request:
3 | body: null
4 | headers:
5 | Accept: ['*/*']
6 | Accept-Encoding: ['gzip, deflate']
7 | Connection: [keep-alive]
8 | Content-Type: [application/json]
9 | Shippo-API-Version: ['2017-03-29']
10 | User-Agent: [Shippo/v1 PythonBindings/1.4.0]
11 | X-Shippo-Client-User-Agent: ['{"lang": "python", "publisher": "shippo", "httplib":
12 | "requests", "uname": "Darwin guozhen-shippo-mbp.local 16.4.0 Darwin Kernel
13 | Version 16.4.0: Thu Dec 22 22:53:21 PST 2016; root:xnu-3789.41.3~3/RELEASE_X86_64
14 | x86_64 i386", "lang_version": "2.7.10", "platform": "Darwin-16.4.0-x86_64-i386-64bit",
15 | "bindings_version": "1.4.0"}']
16 | method: GET
17 | uri: https://api.goshippo.com/shipments/EXAMPLE_OF_INVALID_ID/rates/
18 | response:
19 | body:
20 | string: !!binary |
21 | H4sIAAAAAAAAAxXMQQrCMBAF0Kv8Ezh0HwKFthCIVUTFXSh0JF2YpJlpvb51+TbPxMaOWTHkLc2G
22 | Dpli75FRed1YlGc8bh60NyRxKR9OKtS/2vPV9+EyBDc+W++64Dqqk7IQvpMgHeP7PyInaFwEwnXn
23 | ejJU7A9MNOh7cwAAAA==
24 | headers:
25 | connection: [keep-alive]
26 | content-encoding: [gzip]
27 | content-length: ['127']
28 | content-type: [text/html]
29 | date: ['Mon, 10 Apr 2017 21:03:41 GMT']
30 | p3p: [CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"]
31 | server: [nginx/1.8.0]
32 | vary: ['Host, Cookie']
33 | status: {code: 404, message: NOT FOUND}
34 | version: 1
35 |
--------------------------------------------------------------------------------
/shippo/test/fixtures/shipment/test_invalid_retrieve:
--------------------------------------------------------------------------------
1 | interactions:
2 | - request:
3 | body: null
4 | headers:
5 | Accept: ['*/*']
6 | Accept-Encoding: ['gzip, deflate']
7 | Connection: [keep-alive]
8 | Content-Type: [application/json]
9 | Shippo-API-Version: ['2017-03-29']
10 | User-Agent: [Shippo/v1 PythonBindings/1.4.0]
11 | X-Shippo-Client-User-Agent: ['{"lang": "python", "publisher": "shippo", "httplib":
12 | "requests", "uname": "Darwin guozhen-shippo-mbp.local 16.4.0 Darwin Kernel
13 | Version 16.4.0: Thu Dec 22 22:53:21 PST 2016; root:xnu-3789.41.3~3/RELEASE_X86_64
14 | x86_64 i386", "lang_version": "2.7.10", "platform": "Darwin-16.4.0-x86_64-i386-64bit",
15 | "bindings_version": "1.4.0"}']
16 | method: GET
17 | uri: https://api.goshippo.com/shipments/EXAMPLE_OF_INVALID_ID
18 | response:
19 | body:
20 | string: !!binary |
21 | H4sIAAAAAAAAAxXMQQqDMBAF0Kv8E3RwHwKCCoFoi9jiLgiOxEWTNBPt9WuXb/OUr/QQC7p4hFXR
22 | JZX05BmZPwdL4RXP0YLOisTv6c2hCLVz3T9s6+6dM8OrtqZxpsF3EYSr2v4VYkDxu0A4n5xvipL+
23 | AUrLn59sAAAA
24 | headers:
25 | connection: [keep-alive]
26 | content-encoding: [gzip]
27 | content-length: ['123']
28 | content-type: [text/html]
29 | date: ['Mon, 10 Apr 2017 21:03:42 GMT']
30 | p3p: [CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"]
31 | server: [nginx/1.8.0]
32 | vary: ['Host, Cookie']
33 | status: {code: 404, message: NOT FOUND}
34 | version: 1
35 |
--------------------------------------------------------------------------------
/shippo/test/fixtures/shipment/test_list_page_size:
--------------------------------------------------------------------------------
1 | interactions:
2 | - request:
3 | body: null
4 | headers:
5 | Accept: ['*/*']
6 | Accept-Encoding: ['gzip, deflate']
7 | Connection: [keep-alive]
8 | Content-Type: [application/json]
9 | Shippo-API-Version: ['2017-03-29']
10 | User-Agent: [Shippo/v1 PythonBindings/1.4.0]
11 | X-Shippo-Client-User-Agent: ['{"lang": "python", "publisher": "shippo", "httplib":
12 | "requests", "uname": "Darwin guozhen-shippo-mbp.local 16.4.0 Darwin Kernel
13 | Version 16.4.0: Thu Dec 22 22:53:21 PST 2016; root:xnu-3789.41.3~3/RELEASE_X86_64
14 | x86_64 i386", "lang_version": "2.7.10", "platform": "Darwin-16.4.0-x86_64-i386-64bit",
15 | "bindings_version": "1.4.0"}']
16 | method: GET
17 | uri: https://api.goshippo.com/shipments/?results=1
18 | response:
19 | body:
20 | string: !!binary |
21 | H4sIADHz61gC/+2c624bNxaAX4XQj/3VjHkdkgaKXTdxdrPoJaiSFttFIfByxp6tNKPOjJy4QYB9
22 | jf3XJ9iH6KPsk+zhSL5Jsi3HjtXUDpAgwznkkIffOTw8Q827QahnVTfYJVbzz8iggrfpYnDYddN2
23 | d2fHTcvsoG4Py+m0zkI92TliO+lqAlXX7vy5gXY27trP2Z+m7gA+5wNsYtrAUVnPWmymmo3HWLKQ
24 | woJ/vhsE1zQlNCMX+if3pT+iUO3/BaEbhQZcBzH1gVOmn1D5hNFXnO1SsSvyjGv7w+BMejaNl0ub
25 | jFF5XrrsBa0w1ORaOq6dLHSBV5FpyZ2MReBanKtQv6mgSXUOZvUvh1D95bwqklzbua4f6WD4+unT
26 | /eEwFboYccTtqGhQaJe8W3p8DIWilEvpsQ/KWKusKpTKo1faCptaKNsRPmA6hg6wStfMIE2Nm6Sr
27 | wZdu1jjyBRw2ULXk+1mqkKRdddx3pO/gvHMNQDeq6l49TJ2VsVTydOyOu7oiwy5Ld47cuERllnU1
28 | Opuvd+9P6/BU56wJcXIZym7+XFeR542rQtmG+kQ3fYef7qXLX8ppP3zJmJ53GWe/6au+7tU2Payr
29 | Xp5SppQSkqE2xEId2KUyInOlG59x1UHbLfTz/pzeu3qN1hkLIffBMuMkk8FQWsigTcE5NQXIa7X+
30 | 9/oQVTUpu8Mlfb+oyg7C4YrCl7Rtc0W+Ktu27DWeijdW+rADIg29E91Tca3uc0GFEBr/3kD3U9cE
31 | GC9MfKH50058t/fli2fnzOpKG1eZ1GJjG88zwcyqjUcVNVAu8tw6GWzwiiqceSUKA95EfxMb7wCZ
32 | mI9kMXb0kY07magxVAcIBTagMop/UpU3ZVwuOoTy4LC7WBZLVFEVYDRDhtKt0D/wzakoPxWdOAT7
33 | RGzsF+zMYOQmC/+96Nu8NMwa9A7h+Kx8Ap1DPboeilnb1RNoyItnhHEhVZ7aG5cVjJDlyalLPj/H
34 | 6frE8Y/iYmLn8yGeCPaK6V2hd5XNDNM/nPeCDXSzpnr0g/fnB0M/ve0oQhi7ph/KGnYHbXlQ4erV
35 | IC11VZTN5ERyoecGCkgQwYidjLGs2lkaGvQNnIMMu94b+CmNiAZFeAfvLzQ0111fhjq56C2udAom
36 | o2rNUh5NXlgoVMiBSROo4zxnHL28ZgUWmBst5Qu4Nw0RXNc1pZ8thjF4vjd8tT98NfjxghbQm9m+
37 | F5fqajSuQz+Xq7JntxY1pk19hLPfD+P1y+H5olE5wQBspNX54G0+wCcJwDJkrcjcxP1SV+5N24dy
38 | J3XbHa12sL1sWh2saRNn8oMaxXrnW22hOSpxjYAjGPf4nNjx14gkeeaOyV7Z/Pbf3uPWP0ECcTCb
39 | tqMUkaLDOR65spm746b3UHOO8Ea6YEmfGFceQTvyvZIZ3RV0d+FnZ3MrGJ3V7T1i2+L4Tr3dUmCa
40 | xBxGClEhXlFbaU10wfLgwUpgNuTBDC4aX7Luue0mY8PubQ63WIVbxMChcCaoRKIR1gAvhDS5oVJG
41 | yu8P7iWmZTZ/+CZML8s+QKbJ0B3BdWSP2iR0E74Vwv3p8M1X+caHaEYV0IIp/L/3kUPujTdCF7kT
42 | blt8c5GZfEO+V2QfCN9DwJghXuG1217gWr/Nl7leRCmfJtHCBF9Qyyi4IHG/YTwGtpYyjH8o87TY
43 | GtF5Ju2mRC/LPkiiyV72VXYt1rj52pzsTy0iYat8+zxAEaiVzlOpffA0KucZj1FTWTjYFt8sz6zc
44 | kO8V2QfC9yvcJsOThPcQ74ZuDdyi57rtb1/Ktfh0PTZdJZpDNDxtHF1hZQDpQSjJhHFWa6E83RrR
45 | Mpsn/DYheln2gRD91wb1EFcoPjgrXsdvvjG/z2CMUs0x6UrEmBy55jgji0KIZNbO3Hh8TMqKsCeK
46 | +FlbVkg7Sc/Jflfs60wtcnIX2FeMyqBjgR69kMx5w4PRNue8sLnQMd8a+wJtdVP2l2WvZP85xP23
47 | d0p/3+JH4P9CuzexgAIivL3OBlZ2k7f14XnIC86kNNxqnPLoOQYKEXIoctzJeX4pxwM+uBHG+SrG
48 | wMDYPCjDXI5BN7c05tE4Z1IeUIiwtaCbZnbjoHtZ9kFhvP92mt4UzPMka2iG+f1rUiRqNeDO7yDg
49 | /nC06e3ZFp6iGkP0TEQpjHI0OsHBSAFasy2mSHg2F9qE7WXZB8U2TzvKNUzzFGtfyrL81FlWa9J9
50 | xjtfRK5D4BJUcDEHxLvQ1IZo3dbS2VzegOVl2YfHcp8ZuQzoqxIiKxvHu0mI3B/Ta94/cukcyGhM
51 | VFYaIb0sgshlUIUqgFq9LaYFzzjbkOkV2QfF9LBzVXRNJN9gbFH15y5W2W4XQqP6gtCGlN/Fi5r7
52 | o3zdi0hZKAeCC2WozK1JacCoc/TyeBG03RrlbHPPvSL7oCh/2ZR1U3bHV1I+XQhtQPlHSm5/MOU3
53 | ToeseXnDPRJdREeVDVJwZVwRLfXKMmkwVInbojwXGdv0deSK7IOi/HnZtN2ViBdJ4oP4puYT8uKS
54 | r0l1FyAw8vYFKOCSscJrl7tItVSgTeT3yPfjWak/4lmpXDODGznOkWfJuHIxGOFz52OU3kV2V857
55 | LdwSvPFC4Q7TWFmI4FjueBG01kwL5m52pv/xrNTjWakt8s3sKt/MG+2M9DlXQuYitz4Cy4PmGId7
56 | xm50nv3xrNTjWal7JnrNLzQstyAddVIVRqK/9gz9NVU0eqYh396b98ezUn+Ys1Jb5RtwN5lDUOi1
57 | kUOZftSCQb4Hw6ymzmwtafJ4VuoTPit1f0SvOy8CMsmmXDeTeVG4ArtSSBdVDE4C2xrRj2elHsJZ
58 | qfthP8+UWZMcpB6USBE3E1ZGpaxAF55HyDlEHY3cWrTCM7ppzmRF9mr2h3cN//Dj0D/cAP/T/PdX
59 | rhyTxXmTi9bQojmcZsDhnMTtQvHTbCSJpyZSk0ndduR1NsxImoJUY2MzgNyAVd4qEEIK5ozGrWCI
60 | kXtjWeD+8hwi2zyFeIkVQBEpo5Rzaa1UTnihmGLROA6eWnaPv28YfLE/fPXd3pev99O9p3/b33u5
61 | mlC0Gd00kl8WfaCmcblJbJ5tuX6NeFN2h2kl+Azt6Ldf64aIfiH47VfvWlws6oq8OcRlgxzXs4ZM
62 | XfgJFUFwyA3yShxuPOa3y+5///5PSzyU1QFpEaXfnQmt+QlFUBbhlkaEXEhKleUC1xLBDJVccLW1
63 | EwM203pjW7ko+oBspf/IxWJTsMZW+tvXbQr0zQ0GjYWnZcPcKGC6FeY/Lj3j3aBFa+x/+H8SFoc6
64 | wsnepVt8NujbZBDDBZffO1z6qoPd+XdP0Eh3yIuq/7wC6T/OAA35ejbx0GTk2/4jEWje/XcBiEPz
65 | xqK0WKcWcci93d2iC/9IvqSsjmqcWDLBnV0KUUn6Qg/pDoHEsp2O3XHqwMnHCuZdufWDX7fpOxtz
66 | v3Vx1AQp9GXVTzopW1LVHfkZ4+SyKLEfON0NBEAASAUHdVem1ud9ur02HifkI0+In7+fWNsr+HmG
67 | VkcKVCbEjLwcAy57aILHxB04NPU6daTqXOjm/atJO8N/m4647uS/F9aC7MRcr/vCy4Xvubz/PzwQ
68 | wrj7SwAA
69 | headers:
70 | allow: [OPTIONS]
71 | connection: [keep-alive]
72 | content-encoding: [gzip]
73 | content-length: ['2685']
74 | content-type: [application/json]
75 | date: ['Mon, 10 Apr 2017 21:03:45 GMT']
76 | p3p: [CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"]
77 | server: [nginx/1.8.0]
78 | vary: ['Host, Cookie, Accept-Encoding']
79 | status: {code: 200, message: OK}
80 | version: 1
81 |
--------------------------------------------------------------------------------
/shippo/test/fixtures/track/test_create:
--------------------------------------------------------------------------------
1 | interactions:
2 | - request:
3 | body: !!python/unicode '{"tracking_number": "9205590164917337534322", "carrier":
4 | "usps", "metadata": "metadata"}'
5 | headers:
6 | Accept: ['*/*']
7 | Accept-Encoding: ['gzip, deflate']
8 | Connection: [keep-alive]
9 | Content-Length: ['88']
10 | Content-Type: [application/json]
11 | Shippo-API-Version: ['2017-03-29']
12 | User-Agent: [Shippo/v1 PythonBindings/1.4.0]
13 | X-Shippo-Client-User-Agent: ['{"lang": "python", "publisher": "shippo", "httplib":
14 | "requests", "uname": "Darwin guozhen-shippo-mbp.local 16.4.0 Darwin Kernel
15 | Version 16.4.0: Thu Dec 22 22:53:21 PST 2016; root:xnu-3789.41.3~3/RELEASE_X86_64
16 | x86_64 i386", "lang_version": "2.7.10", "platform": "Darwin-16.4.0-x86_64-i386-64bit",
17 | "bindings_version": "1.4.0"}']
18 | method: POST
19 | uri: https://api.goshippo.com/tracks/
20 | response:
21 | body:
22 | string: !!binary |
23 | H4sIADvz61gC/92XWW8bNxCA/8pCz43A+9i3tHGBoK0TRHKLpiiE4WWzXu0Ku5TbJPB/L3dtRVKs
24 | SnKUwEEBPazI4XD4zcHhh5GFto2+HZXFaNktutF3xSi1YK9jfTmrl3NzN6UJ4lwjLJjGklLJKaOE
25 | 9MLgXOu7bhbaZp4lP4xsTO/6Jf1klyD51Z/3cbH6tM2yTu0gdjEZ3W6oSc2Wku99e+0r/25L2Q/P
26 | N9RpJhHfrdMn6P+RbPYzTJ4hNUWoHH5vB32+vYk2a7/x1bBpaq59vQIxW7SxaXszsmgN82Hn1/dj
27 | xS8Qq2GPed7Ewd1GH783GfZWL7tBf2P+8jbNbOvzQdyWaXqKcMlQieWYYz6Ydy+9XLhHSMdBUAAz
28 | gAEYU5Rxa7XD2CCrDASgTusVzcGu0Yuzn1/+evbm7MV6eObyUWI1TP/eLNuiu4qLua9TcQVdYbyv
29 | C+ereONb7wpIRbryeaBLsYYUm7qY58Wm+We8qfHeeRvewLzEeuWNqrHD2i/k/ttNH1zFLjXD3B97
30 | vSCn2R4mSyLGSu7g6gRnnHPnFWfMcGsoIOc5VYISDVJtc704/+n81W/nu6lOM7GLyevJALT11meY
31 | buCYz2tT29TRrqnHOjTt/I4t1K6IXQF/Q8y8L4c1Mfn5XthyO/Q3YNfLqsqwTuICWFrLhKGCaBaQ
32 | MAQ8kUCtxYQ5Lh7JpT/2oj9aBcZX65C7N20gkFb8PgcF2Y1iHXcTqIsfW6ht7GyzL/gworuDby/P
33 | XIhkSVXJ9VhLuSPOcDCSCmqY0ExzqRHSPHgVsLMSFN3mOX3z/Hzycvqo7AVr/SKtk3dAmUvbZayL
34 | ADZWGcQBin3qsm+GonpIEQHFGjxSBAWGOCibKyI30hFtCLanUexvzZuT+BF0qPodz0+pr8GPaeQc
35 | 0sJgw5xWSrhAuBcUlBNY8ZP4Ob+ANvmNRD4WW775+LeMTQaiJReMauYZF1IZY4A7jTmywqDwxcPu
36 | WHC56u0H9wquq1xb9yET+D8u2wPIMC0ZLrkYS8UeIqMI5aZSKGl0zlSFNZVaAA5cY4QBk6eItOxm
37 | WpKnA6b7Bo/xMSE7LlytBTMaCGFUMmq9zjWOANXEMp9HTkvNT2Js0XSpaELIrfIhYKK3+av1c8cT
38 | Ew+JWUd4EBgDB8SMlyq3KJ4LBZCBEY9Pv1K7Zogy28wXlU++OhRe+GD9fzpaATPKtCaMaM9UfkoQ
39 | AEUEh1zx8gX6+TUsd2vNMhW5m109II7ARJ4K06F3FkcM6T4HlRW5s1DAAmck6GAcCjJ8kob/z3fW
40 | n7f/AogaDfdEEAAA
41 | headers:
42 | allow: [OPTIONS]
43 | connection: [keep-alive]
44 | content-encoding: [gzip]
45 | content-length: ['981']
46 | content-type: [application/json]
47 | date: ['Mon, 10 Apr 2017 21:03:55 GMT']
48 | p3p: [CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"]
49 | server: [nginx/1.8.0]
50 | vary: ['Host, Cookie, Accept-Encoding']
51 | status: {code: 201, message: CREATED}
52 | version: 1
53 |
--------------------------------------------------------------------------------
/shippo/test/fixtures/track/test_get_status:
--------------------------------------------------------------------------------
1 | interactions:
2 | - request:
3 | body: null
4 | headers:
5 | Accept: ['*/*']
6 | Accept-Encoding: ['gzip, deflate']
7 | Connection: [keep-alive]
8 | Content-Type: [application/json]
9 | Shippo-API-Version: ['2017-03-29']
10 | User-Agent: [Shippo/v1 PythonBindings/1.4.0]
11 | X-Shippo-Client-User-Agent: ['{"lang": "python", "publisher": "shippo", "httplib":
12 | "requests", "uname": "Darwin guozhen-shippo-mbp.local 16.4.0 Darwin Kernel
13 | Version 16.4.0: Thu Dec 22 22:53:21 PST 2016; root:xnu-3789.41.3~3/RELEASE_X86_64
14 | x86_64 i386", "lang_version": "2.7.10", "platform": "Darwin-16.4.0-x86_64-i386-64bit",
15 | "bindings_version": "1.4.0"}']
16 | method: GET
17 | uri: https://api.goshippo.com/tracks/usps/9205590164917337534322
18 | response:
19 | body:
20 | string: !!binary |
21 | H4sIADzz61gC/92XbW/bNhCA/4rgz6vB9xd969YMKLalReNs2IYhOL4lXGTJkOhsXZH/PoqJF7v1
22 | bGdOkWKAYUji8Xh87nh3/DCx0PfR95O6miyHxTD5qpqkHux1bC8v2uXc3A1pgjjXCAumsaRUcsoo
23 | IaMwONf7YbgIfTfPkh8mNqb345RxcEiQ/Orlr7hYPdpu2aa+iJ2fTW7X1KRuQ8nXvr/2jX+/oeyb
24 | l2vqNJOIb9fpE4xvJJv9ApMXSM0Qqsvvl6LP9zfRZu03vimLpu7atysQF4s+dv1oRhZtYV5Wfnv/
25 | rfoBYlPWmOdFHNwt9M/zOsPR6uVQ9Hfmd2/The193ojbME3PEK4ZqrGccsyLeffSy4V7hHQsgoIG
26 | wgixKgjNnCTZqiCdDCYoKZGAFc1i1+TVyfevfzx5d/Lq4fOFy1uJTRn+uVv21XAVF3PfpuoKhsp4
27 | 31bON/HG995VkKp05fOHIcUWUuzaap4nm+7P6brGe+eteQPzGuuVN5rOlrlP5P7bdR9cxSF1ZezX
28 | nV6Qs2wPkzURUyW3cMWGEUwsV8oq5gwxwMEpYY3MVhBGN7men353+uan0+1UZ5nY+dnbswK099Zn
29 | mK5wzPu1qe/aaB+oxzZ0/fyOLbSuikMFf0DMvC/LnJj8fCdsuRn6a7DbZdNkWEdxCQoRLqQBJQOj
30 | UoGmgQtqqUOMgnCP5DJuezFurQHjm4eQuzetEEgrfv8FBdmO4iHuzqCtvu2htXGw3a7gw4huD76d
31 | PHMikjVVNddTLeWnPLnBmhLupAWSz68EJH2gyCMNwVKCNnnO3r08PXs9e9TpBWv9Ij0c3oIyp7bL
32 | 2FYBbGwyiD0Ux6PLvhiK6lOKhElfYlAjzoST4LVFGIPRDLAQ5iiKY9W8OYofQfuy3+H8lPoM/DyX
33 | XnDQRuRq4ixSOe9hA9gYhbkW4ih+zi+gT37tIB+KLVc+/iVjYwHASaGwtrlJMlojzQ3Nf4KSYDQ8
34 | edgdCi5nvd3g3sB1k3PrLmQC/0ux3YMM05rhmoupVGxLXXXeuUAkwdwxbcBI7ZzPmQ8rp0OgzxFp
35 | 2c20Js8HTI8NHuNTQrYUXGsQALJee+EYCK81MdqNJYOqHGzsKWNs0Q2p6kLIrfI+YGK0+bP1c4cT
36 | E1uKAc41wBgsNEYsVwNNFTUomNy5sECCO4pYKalDV6LMdvNF45Nv9oUX3pv/n48WQ9hQzoyyWDKT
37 | K6hFlGLwXBCr3ceN7iNo5W6tW6Yqd7OrC8QBmMhzYdp3zwIQMggFgSjMUO4wKDJCBRSY4zKQj4Lq
38 | /3nP+u32b09FdrxEEAAA
39 | headers:
40 | allow: [OPTIONS]
41 | connection: [keep-alive]
42 | content-encoding: [gzip]
43 | content-length: ['984']
44 | content-type: [application/json]
45 | date: ['Mon, 10 Apr 2017 21:03:56 GMT']
46 | p3p: [CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"]
47 | server: [nginx/1.8.0]
48 | vary: ['Host, Cookie, Accept-Encoding']
49 | status: {code: 200, message: OK}
50 | version: 1
51 |
--------------------------------------------------------------------------------
/shippo/test/fixtures/track/test_invalid_create:
--------------------------------------------------------------------------------
1 | interactions:
2 | - request:
3 | body: !!python/unicode '{"tracking_number": "9205590164917337534322", "carrier":
4 | "EXAMPLE_OF_INVALID_CARRIER", "metadata": "metadata"}'
5 | headers:
6 | Accept: ['*/*']
7 | Accept-Encoding: ['gzip, deflate']
8 | Connection: [keep-alive]
9 | Content-Length: ['110']
10 | Content-Type: [application/json]
11 | Shippo-API-Version: ['2017-03-29']
12 | User-Agent: [Shippo/v1 PythonBindings/1.4.0]
13 | X-Shippo-Client-User-Agent: ['{"lang": "python", "publisher": "shippo", "httplib":
14 | "requests", "uname": "Darwin guozhen-shippo-mbp.local 16.4.0 Darwin Kernel
15 | Version 16.4.0: Thu Dec 22 22:53:21 PST 2016; root:xnu-3789.41.3~3/RELEASE_X86_64
16 | x86_64 i386", "lang_version": "2.7.10", "platform": "Darwin-16.4.0-x86_64-i386-64bit",
17 | "bindings_version": "1.4.0"}']
18 | method: POST
19 | uri: https://api.goshippo.com/tracks/
20 | response:
21 | body: {string: !!python/unicode '{"carrier": ["Invalid value specified for provider
22 | ''EXAMPLE_OF_INVALID_CARRIER''"]}'}
23 | headers:
24 | allow: [OPTIONS]
25 | connection: [keep-alive]
26 | content-length: ['82']
27 | content-type: [application/json]
28 | date: ['Mon, 10 Apr 2017 21:03:57 GMT']
29 | p3p: [CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"]
30 | server: [nginx/1.8.0]
31 | vary: ['Host, Cookie']
32 | status: {code: 400, message: BAD REQUEST}
33 | - request:
34 | body: !!python/unicode '{"tracking_number": "EXAMPLEOFINVALID123TRACKINGNUMBER",
35 | "carrier": "usps", "metadata": "metadata"}'
36 | headers:
37 | Accept: ['*/*']
38 | Accept-Encoding: ['gzip, deflate']
39 | Connection: [keep-alive]
40 | Content-Length: ['99']
41 | Content-Type: [application/json]
42 | Shippo-API-Version: ['2017-03-29']
43 | User-Agent: [Shippo/v1 PythonBindings/1.4.0]
44 | X-Shippo-Client-User-Agent: ['{"lang": "python", "publisher": "shippo", "httplib":
45 | "requests", "uname": "Darwin guozhen-shippo-mbp.local 16.4.0 Darwin Kernel
46 | Version 16.4.0: Thu Dec 22 22:53:21 PST 2016; root:xnu-3789.41.3~3/RELEASE_X86_64
47 | x86_64 i386", "lang_version": "2.7.10", "platform": "Darwin-16.4.0-x86_64-i386-64bit",
48 | "bindings_version": "1.4.0"}']
49 | method: POST
50 | uri: https://api.goshippo.com/tracks/
51 | response:
52 | body:
53 | string: !!binary |
54 | H4sIAD7z61gC/02PTw+CMAzFv4rZ2Yt684aKhoho8E9MjCFzVF2EjWydiRK+uxuKcOvr6++1LQmj
55 | SnFQZNwjRhea9HsEFWUPLm6JMPnla/lHb7UJ/fU8iA5eGMwGw9Eu9qbLIFpE+9XEjx1H01SB1slV
56 | ydxCJWEcX452pkaK0Ig3L5qSSSNQ1WP7Lak6MShtU5gssz1A2goN6skZZPCErN6D8gGi9QXN4adc
57 | Xm7hlNYBbd19051mdMv/jTvXKOvbTufqA3AEdEUrAQAA
58 | headers:
59 | allow: [OPTIONS]
60 | connection: [keep-alive]
61 | content-encoding: [gzip]
62 | content-length: ['204']
63 | content-type: [application/json]
64 | date: ['Mon, 10 Apr 2017 21:03:58 GMT']
65 | p3p: [CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"]
66 | server: [nginx/1.8.0]
67 | vary: ['Host, Cookie, Accept-Encoding']
68 | status: {code: 201, message: CREATED}
69 | version: 1
70 |
--------------------------------------------------------------------------------
/shippo/test/fixtures/track/test_invalid_get_status:
--------------------------------------------------------------------------------
1 | interactions:
2 | - request:
3 | body: null
4 | headers:
5 | Accept: ['*/*']
6 | Accept-Encoding: ['gzip, deflate']
7 | Connection: [keep-alive]
8 | Content-Type: [application/json]
9 | Shippo-API-Version: ['2017-03-29']
10 | User-Agent: [Shippo/v1 PythonBindings/1.4.0]
11 | X-Shippo-Client-User-Agent: ['{"lang": "python", "publisher": "shippo", "httplib":
12 | "requests", "uname": "Darwin guozhen-shippo-mbp.local 16.4.0 Darwin Kernel
13 | Version 16.4.0: Thu Dec 22 22:53:21 PST 2016; root:xnu-3789.41.3~3/RELEASE_X86_64
14 | x86_64 i386", "lang_version": "2.7.10", "platform": "Darwin-16.4.0-x86_64-i386-64bit",
15 | "bindings_version": "1.4.0"}']
16 | method: GET
17 | uri: https://api.goshippo.com/tracks/EXAMPLE_OF_INVALID_CARRIER/9205590164917337534322
18 | response:
19 | body: {string: !!python/unicode '{"detail": "Carrier with name ''EXAMPLE_OF_INVALID_CARRIER''
20 | is not supported."}'}
21 | headers:
22 | allow: [OPTIONS]
23 | connection: [keep-alive]
24 | content-length: ['78']
25 | content-type: [application/json]
26 | date: ['Mon, 10 Apr 2017 21:03:59 GMT']
27 | p3p: [CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"]
28 | server: [nginx/1.8.0]
29 | vary: ['Host, Cookie']
30 | status: {code: 400, message: BAD REQUEST}
31 | - request:
32 | body: null
33 | headers:
34 | Accept: ['*/*']
35 | Accept-Encoding: ['gzip, deflate']
36 | Connection: [keep-alive]
37 | Content-Type: [application/json]
38 | Shippo-API-Version: ['2017-03-29']
39 | User-Agent: [Shippo/v1 PythonBindings/1.4.0]
40 | X-Shippo-Client-User-Agent: ['{"lang": "python", "publisher": "shippo", "httplib":
41 | "requests", "uname": "Darwin guozhen-shippo-mbp.local 16.4.0 Darwin Kernel
42 | Version 16.4.0: Thu Dec 22 22:53:21 PST 2016; root:xnu-3789.41.3~3/RELEASE_X86_64
43 | x86_64 i386", "lang_version": "2.7.10", "platform": "Darwin-16.4.0-x86_64-i386-64bit",
44 | "bindings_version": "1.4.0"}']
45 | method: GET
46 | uri: https://api.goshippo.com/tracks/usps/EXAMPLE_OF_INVALID_TRACKING_NUMBER
47 | response:
48 | body:
49 | string: !!binary |
50 | H4sIAAAAAAAAAxXM0QrCIBQA0F+5X9Bl7yJYuZCchWzRm4xmGIGaV9fvtx7Py2Gh4yZV6FOLC8NN
51 | LPMxeCj+0zxVv8BkNeDaYS3z403YKBPKuxiuWrpL75S5Ca2ObrTicFbm5Mw07KWF70wQt/n5nyFF
52 | qOFFQL6svuwYZv4DgyDqeHsAAAA=
53 | headers:
54 | connection: [keep-alive]
55 | content-encoding: [gzip]
56 | content-length: ['134']
57 | content-type: [text/html]
58 | date: ['Mon, 10 Apr 2017 21:03:59 GMT']
59 | p3p: [CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"]
60 | server: [nginx/1.8.0]
61 | vary: ['Host, Cookie']
62 | status: {code: 404, message: NOT FOUND}
63 | version: 1
64 |
--------------------------------------------------------------------------------
/shippo/test/fixtures/transaction/test_invalid_create:
--------------------------------------------------------------------------------
1 | interactions:
2 | - request:
3 | body: !!python/unicode '{}'
4 | headers:
5 | Accept: ['*/*']
6 | Accept-Encoding: ['gzip, deflate']
7 | Connection: [keep-alive]
8 | Content-Length: ['2']
9 | Content-Type: [application/json]
10 | Shippo-API-Version: ['2017-03-29']
11 | User-Agent: [Shippo/v1 PythonBindings/1.4.0]
12 | X-Shippo-Client-User-Agent: ['{"lang": "python", "publisher": "shippo", "httplib":
13 | "requests", "uname": "Darwin guozhen-shippo-mbp.local 16.4.0 Darwin Kernel
14 | Version 16.4.0: Thu Dec 22 22:53:21 PST 2016; root:xnu-3789.41.3~3/RELEASE_X86_64
15 | x86_64 i386", "lang_version": "2.7.10", "platform": "Darwin-16.4.0-x86_64-i386-64bit",
16 | "bindings_version": "1.4.0"}']
17 | method: POST
18 | uri: https://api.goshippo.com/transactions/
19 | response:
20 | body: {string: !!python/unicode '{"rate": ["This field is required."]}'}
21 | headers:
22 | allow: [OPTIONS]
23 | connection: [keep-alive]
24 | content-length: ['37']
25 | content-type: [application/json]
26 | date: ['Mon, 10 Apr 2017 21:04:10 GMT']
27 | p3p: [CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"]
28 | server: [nginx/1.8.0]
29 | vary: ['Host, Cookie']
30 | status: {code: 400, message: BAD REQUEST}
31 | version: 1
32 |
--------------------------------------------------------------------------------
/shippo/test/fixtures/transaction/test_invalid_retrieve:
--------------------------------------------------------------------------------
1 | interactions:
2 | - request:
3 | body: null
4 | headers:
5 | Accept: ['*/*']
6 | Accept-Encoding: ['gzip, deflate']
7 | Connection: [keep-alive]
8 | Content-Type: [application/json]
9 | Shippo-API-Version: ['2017-03-29']
10 | User-Agent: [Shippo/v1 PythonBindings/1.4.0]
11 | X-Shippo-Client-User-Agent: ['{"lang": "python", "publisher": "shippo", "httplib":
12 | "requests", "uname": "Darwin guozhen-shippo-mbp.local 16.4.0 Darwin Kernel
13 | Version 16.4.0: Thu Dec 22 22:53:21 PST 2016; root:xnu-3789.41.3~3/RELEASE_X86_64
14 | x86_64 i386", "lang_version": "2.7.10", "platform": "Darwin-16.4.0-x86_64-i386-64bit",
15 | "bindings_version": "1.4.0"}']
16 | method: GET
17 | uri: https://api.goshippo.com/transactions/EXAMPLE_OF_INVALID_ID
18 | response:
19 | body:
20 | string: !!binary |
21 | H4sIAAAAAAAAAxXMwQqDMAwA0F/JFxi8l4KgQqFzY2zDWykaqZdUm+h+f+74Ls+k2g5Zoc8HzwYv
22 | mc2+EkGh/SBRmuH99IBnjVoiS5x0zSzYjc3t4btw74MbPo13bXAtfKMAX9vy3yAzaFoFhMpJpTK4
23 | 2R/VoGF/bwAAAA==
24 | headers:
25 | connection: [keep-alive]
26 | content-encoding: [gzip]
27 | content-length: ['124']
28 | content-type: [text/html]
29 | date: ['Mon, 10 Apr 2017 21:04:11 GMT']
30 | p3p: [CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"]
31 | server: [nginx/1.8.0]
32 | vary: ['Host, Cookie']
33 | status: {code: 404, message: NOT FOUND}
34 | version: 1
35 |
--------------------------------------------------------------------------------
/shippo/test/fixtures/transaction/test_list_all:
--------------------------------------------------------------------------------
1 | interactions:
2 | - request:
3 | body: null
4 | headers:
5 | Accept: ['*/*']
6 | Accept-Encoding: ['gzip, deflate']
7 | Connection: [keep-alive]
8 | Content-Type: [application/json]
9 | Shippo-API-Version: ['2017-03-29']
10 | User-Agent: [Shippo/v1 PythonBindings/1.4.0]
11 | X-Shippo-Client-User-Agent: ['{"lang": "python", "publisher": "shippo", "httplib":
12 | "requests", "uname": "Darwin guozhen-shippo-mbp.local 16.4.0 Darwin Kernel
13 | Version 16.4.0: Thu Dec 22 22:53:21 PST 2016; root:xnu-3789.41.3~3/RELEASE_X86_64
14 | x86_64 i386", "lang_version": "2.7.10", "platform": "Darwin-16.4.0-x86_64-i386-64bit",
15 | "bindings_version": "1.4.0"}']
16 | method: GET
17 | uri: https://api.goshippo.com/transactions/
18 | response:
19 | body:
20 | string: !!binary |
21 | H4sIAEzz61gC/+1WaW/bRhD9K4SA5FNM7X0IMFJVNlI3dg/LbpAWhbHHrMxWIlkeTpwg/71DSXbl
22 | NqkNxP0QoIAAQnPs7rx9+2bej0LVl91oklGunmWjEt4Of0aXXVe3k/HY1UW+qNrLoq6rPFSr8RUd
23 | d40rWxe6oirb8fPaLWCfjTC3buCqqPoW88t+uURLA22/7AbDL+9Hlf8NQnfRdq6DYYufpsdHB0Pe
24 | YFlnjX48Pzw/XNu2waEBjI6DjxGq94jYo+SM0QkRE0pyws3PO9F9Hf81Wtnd6GIdSAI4rpQxGqQI
25 | ljvnQeooNTEiQqQ7CdWbEpohZ9FX7y6h/GoXmCGug3YAr2t6GIrf1ikZBG6Dt9RSoaR0JFHHgiWK
26 | +eCVXWc2LvxelIuLsl/5zSZ3zLcQbYG9dVwWbVc11wPCv+7a+2Z5UTfVVRH/Wm2JpS0Hz40Bj72C
27 | JhRueVGUV1URYOvd7rKCtsXbbW9Wr5rNarfuziHgblhu1uM5cLHs6CCjjAup1oxwTYD1dkkEKQx4
28 | IawSnHmvHTeORWooC0nE0Ydn2YMocnh6+v3pgxjCJ4TmnLOHMWQdre9GbxiSXAQLDkJwHusyzlNK
29 | IcaYIks6ks9niFYyKiMZ4mJF0sw6noTU1tuoDSHuy2DI+1Fb9XjfQ+75/If5Jj/C7VG30nJ2CVkL
30 | S8QLYjbAs4Kyy4Z7yVbIosxD9qboLosy02i9brMqZUSMKRkPV/YM6TWRbHqSzQ7O8tGHz+SlctoL
31 | Iwgx6ExEOMsDqOQ9EYwYUP8BL9lE2Fxo9TBeYrEkZ1T8k5fO0RCBpUitEZJ4rCJInRhyiQNT6vN5
32 | yQVzQQDnuI0gXhuWbELFsgzlMXD9Py93eUnwtuhj8ZJic3CBRu8FQm+JDdTpgKopWDSc8Afzcn4+
33 | mx3O5/cyk5qJ1BPKc8Xk/czcRotcSfURxeReemMiR1YKR5hlLAYIwiKFaErxEXqqF1oKcA57trAU
34 | sYrGBR2wnSA6In2CmZYRKS2hCnM0p4RyxqV4XL7eTE5dVS3bvG/rdj03Larx2ZAyq8pUNKvpenxC
35 | 8tZ997xqisXa+V2/2v/0Ge+8gpttNmjtRVgWV9Bc74Fru7zluVu5d1Xp3mx2v+9G8jqm5/NiUWLx
36 | DeynA/KEfW3fnh7gB39q+pqkkw7K07Ls/zDHR0/4wdPDt3WBA94+xcbFjVJcPJ2+mk9DwLf3Eq6P
37 | 4v705dH02xfHs5k8eX18/OrohWDTR547/jZlOKeFWstWFCYkZ4MiREltDDDtwyOr+fAK1FrNjX7Y
38 | m1GDmnP7kTnUUjpoKwilsRFBdCnpACwwwXHOiPIRpgwLNliUb5mEEF5bhQ3EKWYQJq1o+ALV/K6Y
39 | UwSbkF1J/8Y1cZKdFG2LZ8mqJsPl3bLYyHuN6rst8z61vssyI/ANBRKVZFoYh9OaSzgREgkcKHMU
40 | l/vwJ5e7WK9YDQAA
41 | headers:
42 | allow: [OPTIONS]
43 | connection: [keep-alive]
44 | content-encoding: [gzip]
45 | content-length: ['1095']
46 | content-type: [application/json]
47 | date: ['Mon, 10 Apr 2017 21:04:12 GMT']
48 | p3p: [CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"]
49 | server: [nginx/1.8.0]
50 | vary: ['Host, Cookie, Accept-Encoding']
51 | status: {code: 200, message: OK}
52 | version: 1
53 |
--------------------------------------------------------------------------------
/shippo/test/fixtures/transaction/test_list_page_size:
--------------------------------------------------------------------------------
1 | interactions:
2 | - request:
3 | body: null
4 | headers:
5 | Accept: ['*/*']
6 | Accept-Encoding: ['gzip, deflate']
7 | Connection: [keep-alive]
8 | Content-Type: [application/json]
9 | Shippo-API-Version: ['2017-03-29']
10 | User-Agent: [Shippo/v1 PythonBindings/1.4.0]
11 | X-Shippo-Client-User-Agent: ['{"lang": "python", "publisher": "shippo", "httplib":
12 | "requests", "uname": "Darwin guozhen-shippo-mbp.local 16.4.0 Darwin Kernel
13 | Version 16.4.0: Thu Dec 22 22:53:21 PST 2016; root:xnu-3789.41.3~3/RELEASE_X86_64
14 | x86_64 i386", "lang_version": "2.7.10", "platform": "Darwin-16.4.0-x86_64-i386-64bit",
15 | "bindings_version": "1.4.0"}']
16 | method: GET
17 | uri: https://api.goshippo.com/transactions/?results=1
18 | response:
19 | body:
20 | string: !!binary |
21 | H4sIAEzz61gC/31SyW7bMBD9FUOHnhqLpChKMhC0RZJDgF4KND20CAxyNLbZyKTAxV2C/HtJRXGU
22 | S49823Ae+ViAjSYUmxWtxPtVYfB3PhSHEEa/KUs56vXe+oMeR7sGeyxPtAxOGi8haGt8+cGhj0Pw
23 | l/TdKPd4yYqUMjo8aRt9SjJxGBIyqxLw47Gw6idC2PogA+Zh3z59vr3OvoxMruLL3c3dzYTNYnCY
24 | 1H3mGKHNBeEXlHxldEP4hpI1qdrvC3Uc+/+qRbdU60lIAGUlRNs2WHPoKikV1k1fN6TlPfZ0YbC/
25 | DLrs2Uf794Dm47KirAvoc43BRczLz3vWDKHqQHW0o1zUtSQ7Khl0RDAFSnST00l40Ga/NfGonoe8
26 | gc8VzcWeiYP2wbo/ueH7JR7dsB2dPen+NW1Iqw2ZeQHStY/oQMthq83JasCZnacc0fv0uv4l3brn
27 | tDMdZCpc5rirmO6Rwla31yvKKl6L6UdIBziN23GoeYuK807wiinVyKqVrKctZbDjffF0//QP6YVT
28 | u5YCAAA=
29 | headers:
30 | allow: [OPTIONS]
31 | connection: [keep-alive]
32 | content-encoding: [gzip]
33 | content-length: ['404']
34 | content-type: [application/json]
35 | date: ['Mon, 10 Apr 2017 21:04:12 GMT']
36 | p3p: [CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"]
37 | server: [nginx/1.8.0]
38 | vary: ['Host, Cookie, Accept-Encoding']
39 | status: {code: 200, message: OK}
40 | version: 1
41 |
--------------------------------------------------------------------------------
/shippo/test/integration/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/goshippo/shippo-python-client/6bca791787a158abc68f1537ec76de0a4ef9e808/shippo/test/integration/__init__.py
--------------------------------------------------------------------------------
/shippo/test/integration/test_integration.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | import unittest2
3 |
4 | from mock import patch
5 |
6 | import shippo
7 | from shippo.config import config
8 | from shippo.test.helper import (
9 | create_mock_shipment,
10 | DUMMY_ADDRESS,
11 | INVALID_ADDRESS,
12 | ShippoTestCase,
13 | )
14 |
15 |
16 | class FunctionalTests(ShippoTestCase):
17 | request_client = shippo.http_client.RequestsClient
18 |
19 | def setUp(self):
20 | super(FunctionalTests, self).setUp()
21 |
22 | def get_http_client(*args, **kwargs):
23 | return self.request_client(*args, **kwargs)
24 |
25 | self.client_patcher = patch(
26 | 'shippo.http_client.new_default_http_client')
27 |
28 | client_mock = self.client_patcher.start()
29 | client_mock.side_effect = get_http_client
30 |
31 | def tearDown(self):
32 | super(FunctionalTests, self).tearDown()
33 |
34 | self.client_patcher.stop()
35 |
36 | def test_dns_failure(self):
37 | api_base = config.api_base
38 | try:
39 | config.api_base = 'https://my-invalid-domain.ireallywontresolve/v1'
40 | self.assertRaises(shippo.error.APIConnectionError,
41 | shippo.Address.create)
42 | finally:
43 | config.api_base = api_base
44 |
45 | def test_run(self):
46 | try:
47 | address = shippo.Address.create(**DUMMY_ADDRESS)
48 | self.assertEqual(address.is_complete, True)
49 | address_validated = shippo.Address.validate(address.object_id)
50 | self.assertEqual(address_validated.is_complete, True)
51 | except shippo.error.AuthenticationError:
52 | self.fail('Set your SHIPPO_API_KEY in your os.environ')
53 | except Exception as inst:
54 | self.fail("Test failed with exception %s" % inst)
55 |
56 | def test_list_accessors(self):
57 | try:
58 | address = shippo.Address.create(**DUMMY_ADDRESS)
59 | except shippo.error.AuthenticationError:
60 | self.fail('Set your SHIPPO_API_KEY in your os.environ')
61 |
62 | self.assertEqual(address['object_created'], address.object_created)
63 | address['foo'] = 'bar'
64 | self.assertEqual(address.foo, 'bar')
65 |
66 | def test_unicode(self):
67 | # Make sure unicode requests can be sent
68 | self.assertRaises(shippo.error.APIError,
69 | shippo.Address.retrieve,
70 | '☃')
71 |
72 | def test_get_rates(self):
73 | try:
74 | shipment = create_mock_shipment()
75 | rates = shippo.Shipment.get_rates(
76 | shipment.object_id, asynchronous=False)
77 | except shippo.error.InvalidRequestError:
78 | pass
79 | except shippo.error.AuthenticationError:
80 | self.fail('Set your SHIPPO_API_KEY in your os.environ')
81 | except Exception as inst:
82 | self.fail("Test failed with exception %s" % inst)
83 | self.assertTrue('results' in rates)
84 |
85 | # --- if dynamic object typing is implemented, this will be a useful test
86 | # def test_missing_id(self):
87 | # address = shippo.Address()
88 | # self.assertRaises(shippo.error.APIError, address.refresh)
89 |
90 |
91 | if __name__ == '__main__':
92 | unittest2.main()
93 |
--------------------------------------------------------------------------------
/shippo/test/test_address.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | import unittest2
3 |
4 | from mock import patch
5 |
6 | import shippo
7 | from shippo.test.helper import (
8 | DUMMY_ADDRESS,
9 | INVALID_ADDRESS,
10 | NOT_POSSIBLE_ADDRESS,
11 | ShippoTestCase,
12 | )
13 |
14 | from shippo.test.helper import shippo_vcr
15 |
16 |
17 | class AddressTests(ShippoTestCase):
18 | request_client = shippo.http_client.RequestsClient
19 |
20 | def setUp(self):
21 | super(AddressTests, self).setUp()
22 |
23 | def get_http_client(*args, **kwargs):
24 | return self.request_client(*args, **kwargs)
25 |
26 | self.client_patcher = patch(
27 | 'shippo.http_client.new_default_http_client')
28 |
29 | client_mock = self.client_patcher.start()
30 | client_mock.side_effect = get_http_client
31 |
32 | def tearDown(self):
33 | super(AddressTests, self).tearDown()
34 |
35 | self.client_patcher.stop()
36 |
37 | @shippo_vcr.use_cassette(cassette_library_dir='shippo/test/fixtures/address')
38 | def test_invalid_create(self):
39 | address = shippo.Address.create(**INVALID_ADDRESS)
40 | self.assertEqual(address.is_complete, False)
41 |
42 | @shippo_vcr.use_cassette(cassette_library_dir='shippo/test/fixtures/address')
43 | def test_create(self):
44 | address = shippo.Address.create(**DUMMY_ADDRESS)
45 | self.assertEqual(address.is_complete, True)
46 |
47 | @shippo_vcr.use_cassette(cassette_library_dir='shippo/test/fixtures/address')
48 | def test_retrieve(self):
49 | address = shippo.Address.create(**DUMMY_ADDRESS)
50 | retrieve = shippo.Address.retrieve(address.object_id)
51 | self.assertItemsEqual(address, retrieve)
52 |
53 | @shippo_vcr.use_cassette(cassette_library_dir='shippo/test/fixtures/address')
54 | def test_invalid_retrieve(self):
55 | self.assertRaises(shippo.error.APIError, shippo.Address.retrieve,
56 | 'EXAMPLE_OF_INVALID_ID')
57 |
58 | @shippo_vcr.use_cassette(cassette_library_dir='shippo/test/fixtures/address')
59 | def test_list_all(self):
60 | address_list = shippo.Address.all()
61 | self.assertTrue('results' in address_list)
62 |
63 | @shippo_vcr.use_cassette(cassette_library_dir='shippo/test/fixtures/address')
64 | def test_list_page_size(self):
65 | pagesize = 1
66 | address_list = shippo.Address.all(size=pagesize)
67 | self.assertEqual(len(address_list.results), pagesize)
68 |
69 | @shippo_vcr.use_cassette(cassette_library_dir='shippo/test/fixtures/address')
70 | def test_invalid_validate(self):
71 | address = shippo.Address.create(**NOT_POSSIBLE_ADDRESS)
72 | self.assertEqual(address.is_complete, True)
73 | address = shippo.Address.validate(address.object_id)
74 | self.assertEqual(address.is_complete, False)
75 |
76 | @shippo_vcr.use_cassette(cassette_library_dir='shippo/test/fixtures/address')
77 | def test_validate(self):
78 | address = shippo.Address.create(**DUMMY_ADDRESS)
79 | self.assertEqual(address.is_complete, True)
80 | address = shippo.Address.validate(address.object_id)
81 |
82 |
83 | if __name__ == '__main__':
84 | unittest2.main()
85 |
--------------------------------------------------------------------------------
/shippo/test/test_api_requestor.py:
--------------------------------------------------------------------------------
1 |
2 | from shippo import api_requestor, config
3 | from mock import patch, Mock
4 | from unittest2 import TestCase
5 | import unittest2
6 | import sys
7 |
8 | from shippo.api_requestor import APIRequestor
9 | from shippo.config import config, Configuration
10 | from shippo.error import ConfigurationError
11 |
12 |
13 | class APIRequestorTests(TestCase):
14 | @patch.object(sys, 'version', '3.8.1 (default, Mar 13 2020, 20:31:03) \n[Clang 11.0.0 (clang-1100.0.33.17)]')
15 | def test_shippo_user_agent(self):
16 | configuration = Configuration()
17 | configuration.app_name = 'TestApp'
18 | configuration.app_version = '1.1.1'
19 | configuration.sdk_version = '0.0.0'
20 |
21 | actual = APIRequestor.get_shippo_user_agent_header(configuration=configuration)
22 | expected = 'TestApp/1.1.1 ShippoPythonSDK/0.0.0 Python/3.8.1'
23 | self.assertEqual(actual, expected)
24 |
25 | def test_oauth_token_auth(self):
26 | config.app_name = 'TestApp'
27 | config.app_version = '1.1.1'
28 |
29 | mock_client = Mock()
30 | mock_client.name = 'mock_client'
31 | mock_client.request.return_value = ('{"status": "ok"}', 200)
32 |
33 | requestor = api_requestor.APIRequestor(
34 | key='oauth.mocktoken.mocksig', client=mock_client)
35 | requestor.request('GET', '/v1/echo')
36 |
37 | args, kwargs = mock_client.request.call_args
38 | method, url, headers, data = args
39 |
40 | self.assertDictContainsSubset(
41 | {'Authorization': 'Bearer oauth.mocktoken.mocksig'},
42 | headers,
43 | "Expect correct token type to used for authorization with oauth token"
44 | )
45 |
46 | def test_shippo_token_auth(self):
47 | config.app_name = 'TestApp'
48 | config.app_version = '1.1.1'
49 |
50 | mock_client = Mock()
51 | mock_client.name = 'mock_client'
52 | mock_client.request.return_value = ('{"status": "ok"}', 200)
53 |
54 | requestor = api_requestor.APIRequestor(
55 | key='shippo_test_mocktoken', client=mock_client)
56 | requestor.request('GET', '/v1/echo')
57 |
58 | args, kwargs = mock_client.request.call_args
59 | method, url, headers, data = args
60 |
61 | self.assertDictContainsSubset(
62 | {'Authorization': 'ShippoToken shippo_test_mocktoken'},
63 | headers,
64 | "Expect correct token type to used for authorization with shippo token"
65 | )
66 |
67 |
68 | if __name__ == '__main__':
69 | unittest2.main()
70 |
--------------------------------------------------------------------------------
/shippo/test/test_customs_declaration.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | import unittest2
3 |
4 | from mock import patch
5 |
6 | import shippo
7 | from shippo.test.helper import (
8 | DUMMY_CUSTOMS_DECLARATION,
9 | INVALID_CUSTOMS_DECLARATION,
10 | DUMMY_CUSTOMS_ITEM,
11 | ShippoTestCase,
12 | )
13 |
14 | from shippo.test.helper import shippo_vcr
15 |
16 |
17 | class CustomsDeclarationTests(ShippoTestCase):
18 | request_client = shippo.http_client.RequestsClient
19 |
20 | def setUp(self):
21 | super(CustomsDeclarationTests, self).setUp()
22 |
23 | def get_http_client(*args, **kwargs):
24 | return self.request_client(*args, **kwargs)
25 |
26 | self.client_patcher = patch(
27 | 'shippo.http_client.new_default_http_client')
28 |
29 | client_mock = self.client_patcher.start()
30 | client_mock.side_effect = get_http_client
31 |
32 | def tearDown(self):
33 | super(CustomsDeclarationTests, self).tearDown()
34 |
35 | self.client_patcher.stop()
36 |
37 | @shippo_vcr.use_cassette(cassette_library_dir='shippo/test/fixtures/customs-declaration')
38 | def test_invalid_create(self):
39 | self.assertRaises(shippo.error.InvalidRequestError, shippo.CustomsDeclaration.create,
40 | **INVALID_CUSTOMS_DECLARATION)
41 |
42 | @shippo_vcr.use_cassette(cassette_library_dir='shippo/test/fixtures/customs-declaration')
43 | def test_create(self):
44 | customs_item = shippo.CustomsItem.create(**DUMMY_CUSTOMS_ITEM)
45 | customs_declaration_parameters = DUMMY_CUSTOMS_DECLARATION.copy()
46 | customs_declaration_parameters["items"][0] = customs_item.object_id
47 | CustomsDeclaration = shippo.CustomsDeclaration.create(
48 | **customs_declaration_parameters)
49 | self.assertEqual(CustomsDeclaration.object_state, 'VALID')
50 |
51 | @shippo_vcr.use_cassette(cassette_library_dir='shippo/test/fixtures/customs-declaration')
52 | def test_retrieve(self):
53 | customs_item = shippo.CustomsItem.create(**DUMMY_CUSTOMS_ITEM)
54 | customs_declaration_parameters = DUMMY_CUSTOMS_DECLARATION.copy()
55 | customs_declaration_parameters["items"][0] = customs_item.object_id
56 | CustomsDeclaration = shippo.CustomsDeclaration.create(
57 | **customs_declaration_parameters)
58 | # Test Retrieving Object
59 | retrieve = shippo.CustomsDeclaration.retrieve(
60 | CustomsDeclaration.object_id)
61 | self.assertItemsEqual(CustomsDeclaration, retrieve)
62 |
63 | @shippo_vcr.use_cassette(cassette_library_dir='shippo/test/fixtures/customs-declaration')
64 | def test_invalid_retrieve(self):
65 | self.assertRaises(
66 | shippo.error.APIError,
67 | shippo.CustomsDeclaration.retrieve,
68 | 'EXAMPLE_OF_INVALID_ID'
69 | )
70 |
71 | @shippo_vcr.use_cassette(cassette_library_dir='shippo/test/fixtures/customs-declaration')
72 | def test_list_all(self):
73 | customs_declaration_list = shippo.CustomsDeclaration.all()
74 | self.assertTrue('results' in customs_declaration_list)
75 |
76 | @shippo_vcr.use_cassette(cassette_library_dir='shippo/test/fixtures/customs-declaration')
77 | def test_list_page_size(self):
78 | pagesize = 1
79 | customs_declaration_list = shippo.CustomsDeclaration.all(size=pagesize)
80 | self.assertEqual(len(customs_declaration_list.results), pagesize)
81 |
82 |
83 | if __name__ == '__main__':
84 | unittest2.main()
85 |
--------------------------------------------------------------------------------
/shippo/test/test_customs_item.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | import unittest2
3 |
4 | from mock import patch
5 |
6 | import shippo
7 | from shippo.test.helper import (
8 | DUMMY_CUSTOMS_ITEM,
9 | INVALID_CUSTOMS_ITEM,
10 | ShippoTestCase,
11 | )
12 |
13 | from shippo.test.helper import shippo_vcr
14 |
15 |
16 | class CustomsItemTest(ShippoTestCase):
17 | request_client = shippo.http_client.RequestsClient
18 |
19 | def setUp(self):
20 | super(CustomsItemTest, self).setUp()
21 |
22 | def get_http_client(*args, **kwargs):
23 | return self.request_client(*args, **kwargs)
24 |
25 | self.client_patcher = patch(
26 | 'shippo.http_client.new_default_http_client')
27 |
28 | client_mock = self.client_patcher.start()
29 | client_mock.side_effect = get_http_client
30 |
31 | def tearDown(self):
32 | super(CustomsItemTest, self).tearDown()
33 | self.client_patcher.stop()
34 |
35 | @shippo_vcr.use_cassette(cassette_library_dir='shippo/test/fixtures/customs-item')
36 | def test_invalid_create(self):
37 | self.assertRaises(shippo.error.InvalidRequestError, shippo.CustomsItem.create,
38 | **INVALID_CUSTOMS_ITEM)
39 |
40 | @shippo_vcr.use_cassette(cassette_library_dir='shippo/test/fixtures/customs-item')
41 | def test_create(self):
42 | customs_item = shippo.CustomsItem.create(**DUMMY_CUSTOMS_ITEM)
43 | self.assertEqual(customs_item.object_state, 'VALID')
44 |
45 | @shippo_vcr.use_cassette(cassette_library_dir='shippo/test/fixtures/customs-item')
46 | def test_retrieve(self):
47 | customs_item = shippo.CustomsItem.create(**DUMMY_CUSTOMS_ITEM)
48 | retrieve = shippo.CustomsItem.retrieve(customs_item.object_id)
49 | self.assertItemsEqual(customs_item, retrieve)
50 |
51 | @shippo_vcr.use_cassette(cassette_library_dir='shippo/test/fixtures/customs-item')
52 | def test_invalid_retrieve(self):
53 | self.assertRaises(shippo.error.APIError,
54 | shippo.CustomsItem.retrieve, 'EXAMPLE_OF_INVALID_ID')
55 |
56 | @shippo_vcr.use_cassette(cassette_library_dir='shippo/test/fixtures/customs-item')
57 | def test_list_all(self):
58 | customs_items_list = shippo.CustomsItem.all()
59 | self.assertTrue('results' in customs_items_list)
60 |
61 | @shippo_vcr.use_cassette(cassette_library_dir='shippo/test/fixtures/customs-item')
62 | def test_list_page_size(self):
63 | pagesize = 1
64 | customs_items_list = shippo.CustomsItem.all(size=pagesize)
65 | self.assertEqual(len(customs_items_list.results), pagesize)
66 |
67 |
68 | if __name__ == '__main__':
69 | unittest2.main()
70 |
--------------------------------------------------------------------------------
/shippo/test/test_manifest.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | import unittest2
3 |
4 | from mock import patch
5 |
6 | import shippo
7 | from shippo.test.helper import (
8 | DUMMY_ADDRESS,
9 | DUMMY_MANIFEST,
10 | INVALID_MANIFEST,
11 | ShippoTestCase,
12 | create_mock_transaction,
13 | create_mock_manifest,
14 | create_mock_shipment
15 | )
16 |
17 | from shippo.test.helper import shippo_vcr
18 |
19 |
20 | class ManifestTests(ShippoTestCase):
21 | request_client = shippo.http_client.RequestsClient
22 |
23 | def setUp(self):
24 | super(ManifestTests, self).setUp()
25 |
26 | def get_http_client(*args, **kwargs):
27 | return self.request_client(*args, **kwargs)
28 |
29 | self.client_patcher = patch(
30 | 'shippo.http_client.new_default_http_client')
31 |
32 | client_mock = self.client_patcher.start()
33 | client_mock.side_effect = get_http_client
34 |
35 | def tearDown(self):
36 | super(ManifestTests, self).tearDown()
37 |
38 | self.client_patcher.stop()
39 |
40 | @shippo_vcr.use_cassette(cassette_library_dir='shippo/test/fixtures/manifest')
41 | def test_invalid_create(self):
42 | self.assertRaises(
43 | shippo.error.InvalidRequestError, shippo.Manifest.create,
44 | **INVALID_MANIFEST)
45 |
46 | @shippo_vcr.use_cassette(cassette_library_dir='shippo/test/fixtures/manifest')
47 | def test_create(self):
48 | transaction = create_mock_transaction()
49 | manifest = create_mock_manifest(transaction)
50 | self.assertEqual(manifest.status, 'SUCCESS')
51 | self.assertEqual(manifest.transactions[0], transaction.object_id)
52 |
53 | @shippo_vcr.use_cassette(cassette_library_dir='shippo/test/fixtures/manifest')
54 | def test_retrieve(self):
55 | manifest = create_mock_manifest()
56 | retrieve = shippo.Manifest.retrieve(manifest.object_id)
57 | self.assertItemsEqual(manifest, retrieve)
58 |
59 | @shippo_vcr.use_cassette(cassette_library_dir='shippo/test/fixtures/manifest')
60 | def test_invalid_retrieve(self):
61 | self.assertRaises(shippo.error.APIError, shippo.Manifest.retrieve,
62 | 'EXAMPLE_OF_INVALID_ID')
63 |
64 | @shippo_vcr.use_cassette(cassette_library_dir='shippo/test/fixtures/manifest')
65 | def test_list_all(self):
66 | manifest_list = shippo.Manifest.all()
67 | self.assertTrue('results' in manifest_list)
68 |
69 | @shippo_vcr.use_cassette(cassette_library_dir='shippo/test/fixtures/manifest')
70 | def test_list_page_size(self):
71 | pagesize = 1
72 | manifest_list = shippo.Manifest.all(size=pagesize)
73 | self.assertEqual(len(manifest_list.results), pagesize)
74 |
75 |
76 | if __name__ == '__main__':
77 | unittest2.main()
78 |
--------------------------------------------------------------------------------
/shippo/test/test_order.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | import unittest2
3 |
4 | from mock import patch
5 | from datetime import datetime
6 |
7 | import shippo
8 | from shippo.test.helper import (
9 | ShippoTestCase,
10 | DUMMY_ORDER
11 | )
12 |
13 | from shippo.test.helper import shippo_vcr
14 |
15 |
16 | class OrderTests(ShippoTestCase):
17 | request_client = shippo.http_client.RequestsClient
18 |
19 | def setUp(self):
20 | super(OrderTests, self).setUp()
21 |
22 | def get_http_client(*args, **kwargs):
23 | return self.request_client(*args, **kwargs)
24 |
25 | self.client_patcher = patch(
26 | 'shippo.http_client.new_default_http_client')
27 |
28 | client_mock = self.client_patcher.start()
29 | client_mock.side_effect = get_http_client
30 |
31 | def tearDown(self):
32 | super(OrderTests, self).tearDown()
33 |
34 | self.client_patcher.stop()
35 |
36 | @shippo_vcr.use_cassette(cassette_library_dir='shippo/test/fixtures/order')
37 | def test_invalid_create(self):
38 | self.assertRaises(shippo.error.InvalidRequestError,
39 | shippo.Order.create)
40 |
41 | @shippo_vcr.use_cassette(cassette_library_dir='shippo/test/fixtures/order')
42 | def test_create(self):
43 | ORDER = DUMMY_ORDER
44 | ORDER['placed_at'] = datetime.now().isoformat() + "Z"
45 | order = shippo.Order.create(**ORDER)
46 | self.assertEqual(order.order_status, 'PAID')
47 |
48 | @shippo_vcr.use_cassette(cassette_library_dir='shippo/test/fixtures/order')
49 | def test_retrieve(self):
50 | ORDER = DUMMY_ORDER
51 | ORDER['placed_at'] = datetime.now().isoformat() + "Z"
52 | order = shippo.Order.create(**ORDER)
53 | retrieve = shippo.Order.retrieve(order.object_id)
54 | self.assertItemsEqual(order.object_id, retrieve.object_id)
55 |
56 | @shippo_vcr.use_cassette(cassette_library_dir='shippo/test/fixtures/order')
57 | def test_invalid_retrieve(self):
58 | self.assertRaises(shippo.error.APIError,
59 | shippo.Order.retrieve, 'EXAMPLE_OF_INVALID_ID')
60 |
61 | @shippo_vcr.use_cassette(cassette_library_dir='shippo/test/fixtures/order')
62 | def test_list_all(self):
63 | order_list = shippo.Order.all()
64 | self.assertTrue('results' in order_list)
65 |
66 | @shippo_vcr.use_cassette(cassette_library_dir='shippo/test/fixtures/order')
67 | def test_list_page_size(self):
68 | pagesize = 1
69 | order_list = shippo.Order.all(size=pagesize)
70 | self.assertEqual(len(order_list.results), pagesize)
71 |
72 | if __name__ == '__main__':
73 | unittest2.main()
74 |
--------------------------------------------------------------------------------
/shippo/test/test_parcel.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | import unittest2
3 |
4 | from mock import patch
5 |
6 | import shippo
7 | from shippo.test.helper import (
8 | DUMMY_PARCEL,
9 | INVALID_PARCEL,
10 | ShippoTestCase,
11 | )
12 |
13 | from shippo.test.helper import shippo_vcr
14 |
15 |
16 | class ParcelTests(ShippoTestCase):
17 | request_client = shippo.http_client.RequestsClient
18 |
19 | def setUp(self):
20 | super(ParcelTests, self).setUp()
21 |
22 | def get_http_client(*args, **kwargs):
23 | return self.request_client(*args, **kwargs)
24 |
25 | self.client_patcher = patch(
26 | 'shippo.http_client.new_default_http_client')
27 |
28 | client_mock = self.client_patcher.start()
29 | client_mock.side_effect = get_http_client
30 |
31 | def tearDown(self):
32 | super(ParcelTests, self).tearDown()
33 |
34 | self.client_patcher.stop()
35 |
36 | @shippo_vcr.use_cassette(cassette_library_dir='shippo/test/fixtures/parcel')
37 | def test_invalid_create(self):
38 | self.assertRaises(shippo.error.InvalidRequestError,
39 | shippo.Parcel.create, **INVALID_PARCEL)
40 |
41 | @shippo_vcr.use_cassette(cassette_library_dir='shippo/test/fixtures/parcel')
42 | def test_create(self):
43 | parcel = shippo.Parcel.create(**DUMMY_PARCEL)
44 | self.assertEqual(parcel.object_state, 'VALID')
45 |
46 | @shippo_vcr.use_cassette(cassette_library_dir='shippo/test/fixtures/parcel')
47 | def test_retrieve(self):
48 | parcel = shippo.Parcel.create(**DUMMY_PARCEL)
49 | retrieve = shippo.Parcel.retrieve(parcel.object_id)
50 | self.assertItemsEqual(parcel, retrieve)
51 |
52 | @shippo_vcr.use_cassette(cassette_library_dir='shippo/test/fixtures/parcel')
53 | def test_invalid_retrieve(self):
54 | self.assertRaises(shippo.error.APIError,
55 | shippo.Parcel.retrieve, 'EXAMPLE_OF_INVALID_ID')
56 |
57 | @shippo_vcr.use_cassette(cassette_library_dir='shippo/test/fixtures/parcel')
58 | def test_list_all(self):
59 | parcel_list = shippo.Parcel.all()
60 | self.assertTrue('results' in parcel_list)
61 |
62 | @shippo_vcr.use_cassette(cassette_library_dir='shippo/test/fixtures/parcel')
63 | def test_list_page_size(self):
64 | pagesize = 2
65 | parcel_list = shippo.Parcel.all(size=pagesize)
66 | self.assertEqual(len(parcel_list.results), pagesize)
67 |
68 |
69 | if __name__ == '__main__':
70 | unittest2.main()
71 |
--------------------------------------------------------------------------------
/shippo/test/test_pickup.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | import unittest2
3 |
4 | from mock import patch
5 | from datetime import datetime, timedelta
6 |
7 | import shippo
8 | from shippo.test.helper import (
9 | create_mock_international_transaction,
10 | ShippoTestCase,
11 | DUMMY_PICKUP
12 | )
13 |
14 | from shippo.test.helper import shippo_vcr
15 |
16 |
17 | class PickupTests(ShippoTestCase):
18 | request_client = shippo.http_client.RequestsClient
19 |
20 | def setUp(self):
21 | super(PickupTests, self).setUp()
22 |
23 | def get_http_client(*args, **kwargs):
24 | return self.request_client(*args, **kwargs)
25 |
26 | self.client_patcher = patch(
27 | 'shippo.http_client.new_default_http_client')
28 |
29 | client_mock = self.client_patcher.start()
30 | client_mock.side_effect = get_http_client
31 |
32 | def tearDown(self):
33 | super(PickupTests, self).tearDown()
34 |
35 | self.client_patcher.stop()
36 |
37 | @shippo_vcr.use_cassette(cassette_library_dir='shippo/test/fixtures/pickup')
38 | def test_create(self):
39 | transaction, carrier_account = create_mock_international_transaction()
40 | PICKUP = DUMMY_PICKUP
41 | PICKUP['carrier_account'] = carrier_account
42 | PICKUP['transactions'] = [transaction.object_id]
43 | pickupTimeStart = datetime.now() + timedelta(hours=1)
44 | pickupTimeEnd = pickupTimeStart + timedelta(days=1)
45 | PICKUP['pickupTimeStart'] = pickupTimeStart.isoformat() + "Z"
46 | PICKUP['pickupTimeEnd'] = pickupTimeEnd.isoformat() + "Z"
47 | try:
48 | pickup = shippo.Pickup.create(**PICKUP)
49 | except shippo.error.InvalidRequestError:
50 | self.assertTrue(True)
51 | else:
52 | self.assertEqual(pickup.status, 'SUCCESS')
53 |
54 | if __name__ == '__main__':
55 | unittest2.main()
56 |
--------------------------------------------------------------------------------
/shippo/test/test_rate.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | import unittest2
3 |
4 | from mock import patch
5 |
6 | import shippo
7 | from shippo.test.helper import (
8 | create_mock_shipment,
9 | ShippoTestCase
10 | )
11 |
12 | from shippo.test.helper import shippo_vcr
13 |
14 |
15 | class RateTests(ShippoTestCase):
16 | request_client = shippo.http_client.RequestsClient
17 |
18 | def setUp(self):
19 | super(RateTests, self).setUp()
20 |
21 | def get_http_client(*args, **kwargs):
22 | return self.request_client(*args, **kwargs)
23 |
24 | self.client_patcher = patch(
25 | 'shippo.http_client.new_default_http_client')
26 |
27 | client_mock = self.client_patcher.start()
28 | client_mock.side_effect = get_http_client
29 |
30 | def tearDown(self):
31 | super(RateTests, self).tearDown()
32 |
33 | self.client_patcher.stop()
34 |
35 | @shippo_vcr.use_cassette(cassette_library_dir='shippo/test/fixtures/rate')
36 | def test_retrieve(self):
37 | shipment = create_mock_shipment()
38 | rates = shippo.Shipment.get_rates(
39 | shipment.object_id, asynchronous=False)
40 | rate = rates.results[0]
41 | retrieve = shippo.Rate.retrieve(rate.object_id)
42 | self.assertItemsEqual(rate, retrieve)
43 |
44 | @shippo_vcr.use_cassette(cassette_library_dir='shippo/test/fixtures/rate')
45 | def test_invalid_retrieve(self):
46 | self.assertRaises(shippo.error.APIError,
47 | shippo.Rate.retrieve, 'EXAMPLE_OF_INVALID_ID')
48 |
49 |
50 | if __name__ == '__main__':
51 | unittest2.main()
52 |
--------------------------------------------------------------------------------
/shippo/test/test_shipment.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | import unittest2
3 |
4 | from mock import patch
5 |
6 | import shippo
7 | from shippo.test.helper import (
8 | create_mock_shipment,
9 | INVALID_SHIPMENT,
10 | ShippoTestCase,
11 | )
12 |
13 | from shippo.test.helper import shippo_vcr
14 |
15 |
16 | class ShipmentTests(ShippoTestCase):
17 | request_client = shippo.http_client.RequestsClient
18 |
19 | def setUp(self):
20 | super(ShipmentTests, self).setUp()
21 |
22 | def get_http_client(*args, **kwargs):
23 | return self.request_client(*args, **kwargs)
24 |
25 | self.client_patcher = patch(
26 | 'shippo.http_client.new_default_http_client')
27 |
28 | client_mock = self.client_patcher.start()
29 | client_mock.side_effect = get_http_client
30 |
31 | def tearDown(self):
32 | super(ShipmentTests, self).tearDown()
33 |
34 | self.client_patcher.stop()
35 |
36 | @shippo_vcr.use_cassette(cassette_library_dir='shippo/test/fixtures/shipment')
37 | def test_invalid_create(self):
38 | self.assertRaises(shippo.error.InvalidRequestError, shippo.Shipment.create,
39 | **INVALID_SHIPMENT)
40 |
41 | @shippo_vcr.use_cassette(cassette_library_dir='shippo/test/fixtures/shipment')
42 | def test_create(self):
43 | shipment = create_mock_shipment()
44 | self.assertEqual(shipment.status, 'SUCCESS')
45 |
46 | @shippo_vcr.use_cassette(cassette_library_dir='shippo/test/fixtures/shipment')
47 | def test_retrieve(self):
48 | shipment = create_mock_shipment()
49 | retrieve = shippo.Shipment.retrieve(shipment.object_id)
50 | self.assertItemsEqual(shipment, retrieve)
51 |
52 | @shippo_vcr.use_cassette(cassette_library_dir='shippo/test/fixtures/shipment')
53 | def test_invalid_retrieve(self):
54 | self.assertRaises(shippo.error.APIError, shippo.Shipment.retrieve,
55 | 'EXAMPLE_OF_INVALID_ID')
56 |
57 | @shippo_vcr.use_cassette(cassette_library_dir='shippo/test/fixtures/shipment')
58 | def test_list_all(self):
59 | shipment_list = shippo.Shipment.all()
60 | self.assertTrue('results' in shipment_list)
61 |
62 | @shippo_vcr.use_cassette(cassette_library_dir='shippo/test/fixtures/shipment')
63 | def test_list_page_size(self):
64 | pagesize = 1
65 | shipment_list = shippo.Shipment.all(size=pagesize)
66 | self.assertEqual(len(shipment_list.results), pagesize)
67 |
68 | @shippo_vcr.use_cassette(cassette_library_dir='shippo/test/fixtures/shipment')
69 | def test_get_rate(self):
70 | shipment = create_mock_shipment()
71 | rates = shippo.Shipment.get_rates(shipment.object_id)
72 | self.assertTrue('results' in rates)
73 |
74 | @shippo_vcr.use_cassette(cassette_library_dir='shippo/test/fixtures/shipment')
75 | def test_get_rates_blocking(self):
76 | shipment = create_mock_shipment()
77 | rates = shippo.Shipment.get_rates(
78 | shipment.object_id, asynchronous=False)
79 | self.assertTrue('results' in rates)
80 |
81 | @shippo_vcr.use_cassette(cassette_library_dir='shippo/test/fixtures/shipment')
82 | def test_invalid_get_rate(self):
83 | # we are testing asynchronous=True in order to test the 2nd API call of the function
84 | self.assertRaises(shippo.error.APIError, shippo.Shipment.get_rates,
85 | 'EXAMPLE_OF_INVALID_ID', asynchronous=True)
86 |
87 |
88 | if __name__ == '__main__':
89 | unittest2.main()
90 |
--------------------------------------------------------------------------------
/shippo/test/test_track.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | import unittest2
3 |
4 | from mock import patch
5 |
6 | import shippo
7 | from shippo.test.helper import ShippoTestCase
8 |
9 | from shippo.test.helper import shippo_vcr
10 |
11 |
12 | class TrackTests(ShippoTestCase):
13 | request_client = shippo.http_client.RequestsClient
14 | usps_tracking_no = '9205590164917337534322'
15 |
16 | def setUp(self):
17 | super(TrackTests, self).setUp()
18 |
19 | def get_http_client(*args, **kwargs):
20 | return self.request_client(*args, **kwargs)
21 |
22 | self.client_patcher = patch(
23 | 'shippo.http_client.new_default_http_client')
24 |
25 | client_mock = self.client_patcher.start()
26 | client_mock.side_effect = get_http_client
27 |
28 | def tearDown(self):
29 | super(TrackTests, self).tearDown()
30 |
31 | self.client_patcher.stop()
32 |
33 | @shippo_vcr.use_cassette(cassette_library_dir='shippo/test/fixtures/track')
34 | def test_get_status(self):
35 | carrier_token = 'usps'
36 | tracking = shippo.Track.get_status(
37 | carrier_token, self.usps_tracking_no)
38 | self.assertTrue(tracking)
39 | self.assertTrue('tracking_status' in tracking)
40 | self.assertTrue('tracking_history' in tracking)
41 |
42 | @shippo_vcr.use_cassette(cassette_library_dir='shippo/test/fixtures/track')
43 | def test_invalid_get_status(self):
44 | self.assertRaises(
45 | shippo.error.InvalidRequestError,
46 | shippo.Track.get_status,
47 | 'EXAMPLE_OF_INVALID_CARRIER',
48 | self.usps_tracking_no
49 | )
50 | self.assertRaises(
51 | shippo.error.APIError,
52 | shippo.Track.get_status,
53 | 'usps',
54 | 'EXAMPLE_OF_INVALID_TRACKING_NUMBER'
55 | )
56 |
57 | @shippo_vcr.use_cassette(cassette_library_dir='shippo/test/fixtures/track')
58 | def test_create(self):
59 | tracking = shippo.Track.create(
60 | carrier='usps',
61 | tracking_number=self.usps_tracking_no,
62 | metadata='metadata'
63 | )
64 | self.assertTrue(tracking)
65 | self.assertTrue('tracking_status' in tracking)
66 | self.assertTrue('tracking_history' in tracking)
67 |
68 | @shippo_vcr.use_cassette(cassette_library_dir='shippo/test/fixtures/track')
69 | def test_invalid_create(self):
70 | self.assertRaises(
71 | shippo.error.InvalidRequestError,
72 | shippo.Track.create,
73 | None,
74 | **{
75 | 'carrier': 'EXAMPLE_OF_INVALID_CARRIER',
76 | 'tracking_number': self.usps_tracking_no,
77 | 'metadata': 'metadata'
78 | }
79 | )
80 | tracking = shippo.Track.create(
81 | carrier='usps',
82 | tracking_number='EXAMPLEOFINVALID123TRACKINGNUMBER',
83 | metadata='metadata'
84 | )
85 | self.assertFalse(tracking.tracking_status)
86 | self.assertFalse(tracking.tracking_history)
87 |
88 |
89 | if __name__ == '__main__':
90 | unittest2.main()
91 |
--------------------------------------------------------------------------------
/shippo/test/test_transaction.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | import unittest2
3 |
4 | from mock import patch
5 |
6 | import shippo
7 | from shippo.test.helper import (
8 | create_mock_shipment,
9 | ShippoTestCase,
10 | DUMMY_TRANSACTION
11 | )
12 |
13 | from shippo.test.helper import shippo_vcr
14 |
15 |
16 | class TransactionTests(ShippoTestCase):
17 | request_client = shippo.http_client.RequestsClient
18 |
19 | def setUp(self):
20 | super(TransactionTests, self).setUp()
21 |
22 | def get_http_client(*args, **kwargs):
23 | return self.request_client(*args, **kwargs)
24 |
25 | self.client_patcher = patch(
26 | 'shippo.http_client.new_default_http_client')
27 |
28 | client_mock = self.client_patcher.start()
29 | client_mock.side_effect = get_http_client
30 |
31 | def tearDown(self):
32 | super(TransactionTests, self).tearDown()
33 |
34 | self.client_patcher.stop()
35 |
36 | @shippo_vcr.use_cassette(cassette_library_dir='shippo/test/fixtures/transaction')
37 | def test_invalid_create(self):
38 | self.assertRaises(shippo.error.InvalidRequestError,
39 | shippo.Transaction.create)
40 |
41 | @shippo_vcr.use_cassette(cassette_library_dir='shippo/test/fixtures/transaction')
42 | def test_create(self):
43 | shipment = create_mock_shipment()
44 | rates = shippo.Shipment.get_rates(
45 | shipment.object_id, asynchronous=False)
46 | rate = rates.results[0]
47 | TRANSACTION = DUMMY_TRANSACTION.copy()
48 | TRANSACTION['rate'] = rate.object_id
49 | transaction = shippo.Transaction.create(**TRANSACTION)
50 | self.assertEqual(transaction.object_state, 'VALID')
51 |
52 | @shippo_vcr.use_cassette(cassette_library_dir='shippo/test/fixtures/transaction')
53 | def test_retrieve(self):
54 | shipment = create_mock_shipment()
55 | rates = shippo.Shipment.get_rates(
56 | shipment.object_id, asynchronous=False)
57 | rate = rates.results[0]
58 | TRANSACTION = DUMMY_TRANSACTION.copy()
59 | TRANSACTION['rate'] = rate.object_id
60 | transaction = shippo.Transaction.create(**TRANSACTION)
61 | retrieve = shippo.Transaction.retrieve(transaction.object_id)
62 | self.assertItemsEqual(transaction, retrieve)
63 |
64 | @shippo_vcr.use_cassette(cassette_library_dir='shippo/test/fixtures/transaction')
65 | def test_invalid_retrieve(self):
66 | self.assertRaises(shippo.error.APIError,
67 | shippo.Transaction.retrieve, 'EXAMPLE_OF_INVALID_ID')
68 |
69 | @shippo_vcr.use_cassette(cassette_library_dir='shippo/test/fixtures/transaction')
70 | def test_list_all(self):
71 | transaction_list = shippo.Transaction.all()
72 | self.assertTrue('results' in transaction_list)
73 |
74 | @shippo_vcr.use_cassette(cassette_library_dir='shippo/test/fixtures/transaction')
75 | def test_list_page_size(self):
76 | pagesize = 1
77 | transaction_list = shippo.Transaction.all(size=pagesize)
78 | self.assertEqual(len(transaction_list.results), pagesize)
79 |
80 |
81 | if __name__ == '__main__':
82 | unittest2.main()
83 |
--------------------------------------------------------------------------------
/shippo/util.py:
--------------------------------------------------------------------------------
1 | import logging
2 |
3 | from shippo.config import config
4 |
5 | logger = logging.getLogger('shippo')
6 |
7 | logging.basicConfig()
8 | vcr_log = logging.getLogger("vcr")
9 | vcr_log.setLevel(config.vcr_logging_level)
10 |
11 |
12 | __all__ = ['json']
13 |
14 | try:
15 | import json
16 | except ImportError:
17 | json = None
18 |
19 | if not (json and hasattr(json, 'loads')):
20 | try:
21 | import simplejson as json
22 | except ImportError:
23 | if not json:
24 | raise ImportError(
25 | "Shippo requires a JSON library, such as simplejson. "
26 | "HINT: Try installing the "
27 | "python simplejson library via 'pip install simplejson' or "
28 | "contact support@goshippo.com with questions.")
29 | else:
30 | raise ImportError(
31 | "Shippo requires a JSON library with the same interface as "
32 | "the Python 2.6 'json' library. You appear to have a 'json' "
33 | "library with a different interface. Please install "
34 | "the simplejson library. HINT: Try installing the "
35 | "python simplejson library via 'pip install simplejson' "
36 | "contact support@goshippo.com with questions.")
37 |
--------------------------------------------------------------------------------
/shippo/version.py:
--------------------------------------------------------------------------------
1 | VERSION = '2.1.3'
2 |
--------------------------------------------------------------------------------
/tox.ini:
--------------------------------------------------------------------------------
1 | # Tox (http://tox.testrun.org/) is a tool for running tests
2 | # in multiple virtualenvs. This configuration file will run the
3 | # test suite on all supported python versions. To use it, "pip install tox"
4 | # and then run "tox" from this directory.
5 | [testenv]
6 | setenv =
7 | SHIPPO_API_KEY={env:SHIPPO_API_KEY}
8 | SHIPPO_API_BASE={env:SHIPPO_API_BASE}
9 |
10 | deps =
11 | pytest
12 | unittest2
13 | requests
14 | vcrpy
15 | mock
16 |
17 | commands =
18 | pytest -v
19 |
20 |
21 | # This test setup will run all tests without using the previously recorded VCR cassettes
22 | # (in GitHub Actions all cassettes will be re-recorded and discarded after the test suite finishes)
23 | [testenv:live]
24 | setenv =
25 | SHIPPO_API_KEY={env:SHIPPO_API_KEY}
26 | SHIPPO_API_BASE={env:SHIPPO_API_BASE}
27 | VCR_RECORD_MODE=all
28 |
29 | commands =
30 | pytest -v shippo/test
31 |
--------------------------------------------------------------------------------