Shipping API Sample. Autogenerated SDK
This Python package is automatically generated by the OpenAPI Generator project:
- API version: 1.0.0
- Package version: 1.0.0
- Build package: org.openapitools.codegen.languages.PythonClientCodegen
Python 2.7 and 3.4+
If the python package is hosted on a repository, you can install directly using:
pip install git+https://github.com/PitneyBowes/pitneybowes-shipping-api-python.git
(you may need to run pip
with root permission: sudo pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git
)
Then import the package:
import pbshipping
Install via Setuptools.
python setup.py install --user
(or sudo python setup.py install
to install the package for all users)
Then import the package:
import pbshipping
Please follow the installation procedure and then run the following:
from __future__ import print_function
import time
import pbshipping
from pbshipping.rest import ApiException
from pprint import pprint
# Defining the host is optional and defaults to https://api-sandbox.pitneybowes.com/shippingservices
# See configuration.py for a list of all supported configuration parameters.
configuration = pbshipping.Configuration(
host = "https://api-sandbox.pitneybowes.com/shippingservices"
)
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.
# Configure OAuth2 access token for authorization: oAuth2ClientCredentials
configuration.access_token = 'YOUR_ACCESS_TOKEN'
# Enter a context with an instance of the API client
with pbshipping.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = pbshipping.AddressValidationApi(api_client)
address = pbshipping.Address(address_lines=['1 Atwell rd','bldg 2','apt 302'],city_town ='Cooperstown',state_province = 'NJ',postal_code = '13326',country_code = 'US',name = 'James Brother',company = 'Mary Imogene Basset Hospital',phone = '555-924-2428',email = 'james.b@email.com' ) # Address | Address object that needs to be validated.
x_pb_unified_error_structure = True # bool | Set this to true to use the standard [error object](https://shipping.pitneybowes.com/reference/error-object.html#standard-error-object) if an error occurs. (optional) (default to True)
minimal_address_validation = True # bool | When set to true, the complete address (delivery line and last line) is validated but only the last line (city, state, and postal code) would be changed by the validation check. (optional)
try:
# Address validation
api_response = api_instance.verify_address(address, x_pb_unified_error_structure=x_pb_unified_error_structure, minimal_address_validation=minimal_address_validation)
pprint(api_response)
except ApiException as e:
print("Exception when calling AddressValidationApi->verify_address: %s\n" % e)
All URIs are relative to https://api-sandbox.pitneybowes.com/shippingservices
Class | Method | HTTP request | Description |
---|---|---|---|
AddressValidationApi | verify_address | POST /v1/addresses/verify | Address validation |
AddressValidationApi | verify_and_suggest_address | POST /v1/addresses/verify-suggest | Address Suggestion |
CarrierInfoApi | get_carrier_facilities | POST /v1/carrier-facility | Find Carrier Facilities |
CarrierInfoApi | get_carrier_license_agreement | GET /v1/carrier/license-agreements | This operation retrieves a carrier's license agreement. |
CarrierInfoApi | get_carrier_service_rules | GET /v1/information/rules/rating-services | Retrieves the rules governing the carrier's services. |
CarrierInfoApi | get_carrier_supported_destination | GET /v1/countries | This operation returns a list of supported destination countries to which the carrier offers international shipping services. |
ContainerApi | get_containerized_parcels_labels | POST /v1/container-manifest | Create Container Manifest Label |
CrossBorderQuotesApi | get_cross_border_quotes | POST /v1/crossborder/checkout/quotes | Cross-Border Quotes |
CrossBorderQuotesApi | predicted_hs_code | POST /v1/crossborder/hs-classification/items | Predicts the HS Code for a parcel |
ManifestsApi | create_manifest | POST /v1/manifests | This operation creates an end-of-day manifest |
ManifestsApi | reprint_manifest | GET /v1/manifests/{manifestId} | reprintManifest |
ManifestsApi | retry_manifest | GET /v1/manifests | retryManifest |
ParcelProtectionApi | cancel_parcel_protection | POST /v1/parcel-protection/void | Parcel Protection Coverage |
ParcelProtectionApi | get_parcel_protection_coverage | POST /v1/parcel-protection/create | Parcel Protection Coverage |
ParcelProtectionApi | get_parcel_protection_quote | POST /v1/parcel-protection/quote | Parcel Protection Quote |
ParcelProtectionApi | get_parcel_protection_reports | GET /v1/parcel-protection/{developerId}/policies | Parcel Protection Reports |
PickupApi | cancel_pickup | POST /v1/pickups/{pickupId}/cancel | Cancel Pickup |
PickupApi | get_pickupschedule | POST /v1/pickups/schedule | Address validation |
RateParcelsApi | rate_parcel | POST /v1/rates | Use this operation to rate a parcel before you print and purchase a shipment label. You can rate a parcel for multiple services and multiple parcel types with a single API request. |
ShipmentApi | cancel_shipment | DELETE /v1/shipments/{shipmentId} | cancelShipment |
ShipmentApi | create_shipment_label | POST /v1/shipments | This operation creates a shipment and purchases a shipment label. |
ShipmentApi | reprint_shipment | GET /v1/shipments/{shipmentId} | reprintShipment |
ShipmentApi | retry_shipment | GET /v1/shipments | retryShipment |
TrackingApi | add_tracking_events | POST /v2/track/events | getTrackingDetails |
TrackingApi | get_tracking_details | GET /v1/tracking/{trackingNumber} | getTrackingDetails |
TransactionReportsApi | get_transaction_report | GET /v4/ledger/developers/{developerId}/transactions/reports | This operation retrieves all transactions for a specified period of time. |
- AddTrackingEvents
- AddTrackingEventsEvents
- AddTrackingEventsReferences
- AdditionalAddress
- Address
- AddressSuggestionResponse
- AddressSuggestionResponseSuggestions
- AddressVerifySuggest
- BatteryDetails
- CancelShipment
- Carrier
- CarrierFacilityRequest
- CarrierFacilityRequestAddress
- CarrierFacilityResponse
- CarrierFacilityResponseCarrierFacilityOptions
- CarrierFacilityResponseCarrierFacilitySuggestions
- CarrierFacilityResponseFacilityHours
- CarrierFacilityResponseFacilityTimings
- CarrierPayment
- CarrierRule
- CommodityInfo
- ContainerDetails
- ContainerManifestResponse
- ContainerManifestResponseData
- CrossBorderQuotesErrors
- CrossBorderQuotesErrorsErrors
- CrossBorderQuotesErrorsErrorsErrors
- CrossBorderQuotesErrorsQuote
- CrossBorderQuotesErrorsQuoteLines
- CrossBorderQuotesErrorsUnitErrors
- CrossBorderQuotesRequest
- CrossBorderQuotesRequestAttributes
- CrossBorderQuotesRequestBasketItems
- CrossBorderQuotesRequestCategories
- CrossBorderQuotesRequestDescriptions
- CrossBorderQuotesRequestIdentifiers
- CrossBorderQuotesRequestItemDimension
- CrossBorderQuotesRequestPricing
- CrossBorderQuotesRequestPricingCodPrice
- CrossBorderQuotesRequestRates
- CrossBorderQuotesRequestUnitWeight
- CrossBorderQuotesResponse
- CrossBorderQuotesResponseLineRates
- CrossBorderQuotesResponseQuote
- CrossBorderQuotesResponseQuoteLines
- CrossBorderQuotesResponseTotalRates
- CrossBorderQuotesResponseUnitRates
- CrossBorderQuotesResponseUnitRatesDeliveryCommitment
- Customs
- CustomsInfo
- CustomsItem
- DeliveryCommitment
- DimensionRules
- DimensionRulesMaxParcelDimensions
- DimensionRulesMinParcelDimensions
- Discount
- DocTabItem
- Document
- DocumentPage
- Errors
- HazmatDetails
- ISOCountryCode
- InfectiousSubstanceContact
- InlineResponse200
- InlineResponse2001
- InlineResponse2002
- Manifest
- PageRealTransactionDetailReport
- Parameter
- Parcel
- ParcelDimension
- ParcelProtectionCreateRequest
- ParcelProtectionCreateRequestShipmentInfo
- ParcelProtectionCreateRequestShipmentInfoConsigneeInfo
- ParcelProtectionCreateRequestShipmentInfoParcelInfo
- ParcelProtectionCreateRequestShipmentInfoParcelInfoCommodityList
- ParcelProtectionCreateRequestShipmentInfoShipperInfo
- ParcelProtectionCreateRequestShipmentInfoShipperInfoAddress
- ParcelProtectionCreateResponse
- ParcelProtectionCreateResponseParcelProtectionFeesBreakup
- ParcelProtectionPolicyResponse
- ParcelProtectionPolicyResponseContent
- ParcelProtectionPolicyResponsePolicyDetails
- ParcelProtectionPolicyResponseShipmentDetails
- ParcelProtectionPolicyResponseShipperInfo
- ParcelProtectionPolicyResponseShipperInfoAddress
- ParcelProtectionPolicyResponseSort
- ParcelProtectionQuoteRequest
- ParcelProtectionQuoteRequestShipmentInfo
- ParcelProtectionQuoteRequestShipmentInfoConsigneeInfo
- ParcelProtectionQuoteRequestShipmentInfoParcelInfo
- ParcelProtectionQuoteRequestShipmentInfoParcelInfoCommodityList
- ParcelProtectionQuoteRequestShipmentInfoShipperInfo
- ParcelProtectionQuoteRequestShipmentInfoShipperInfoAddress
- ParcelProtectionQuoteResponse
- ParcelProtectionQuoteResponseParcelProtectionFeesBreakup
- ParcelType
- ParcelTypeRules
- ParcelWeight
- PrerequisiteRules
- RadioActiveParcelDimension
- RadioActivityDetail
- RadioNuclideDetail
- Rate
- RealTransactionDetailReport
- SchedulePickup
- SchedulePickupPickupSummary
- SchedulePickupResponse
- SchedulePickupTotalWeight
- SearchCriteria
- Services
- ServicesParameterRule
- Shipment
- Signatory
- SpecialService
- SpecialServiceCodes
- SpecialServicesRule
- Surcharge
- Tax
- Trackable
- TrackingAddress
- TrackingResponse
- TrackingResponseScanDetailsList
- UnitOfDimension
- UnitOfWeight
- VoidParcelProtectionRequest
- VoidParcelProtectionResponse
- WeightRules
- Type: OAuth
- Flow: application
- Authorization URL:
- Scopes: N/A