Python-Fedex: a suds fedex api wrapper¶
Contents:
Installation¶
python-fedex is compatible with Python 2.7+. The only other requirement is suds_jurko although the module is also compatible with the original suds module.
For those on Linux/Unix Mac OS, the easiest route will be pip or easy_install:
pip install fedex
Quick Start¶
To get you started, a comprehensive set of examples and tests is included in the examples and tests directory respectively. The examples below are come from the included unit tests.
Initialize Config Object¶
from fedex.config import FedexConfig
CONFIG_OBJ = FedexConfig(key='<key>',
password='<pass>',
account_number='<account_no>',
meter_number='<meter_no>')
Create and Delete a Shipment¶
shipment = FedexProcessShipmentRequest(CONFIG_OBJ)
shipment.RequestedShipment.DropoffType = 'REGULAR_PICKUP'
shipment.RequestedShipment.ServiceType = 'FEDEX_GROUND'
shipment.RequestedShipment.PackagingType = 'YOUR_PACKAGING'
shipment.RequestedShipment.Shipper.Contact.PersonName = 'Sender Name'
shipment.RequestedShipment.Shipper.Contact.PhoneNumber = '9012638716'
shipment.RequestedShipment.Shipper.Address.StreetLines = ['Address Line 1']
shipment.RequestedShipment.Shipper.Address.City = convert_to_utf8('Herndon')
shipment.RequestedShipment.Shipper.Address.StateOrProvinceCode = 'VA'
shipment.RequestedShipment.Shipper.Address.PostalCode = '20171'
shipment.RequestedShipment.Shipper.Address.CountryCode = 'US'
shipment.RequestedShipment.Recipient.Contact.PersonName = 'Recipient Name'
shipment.RequestedShipment.Recipient.Contact.PhoneNumber = '9012637906'
shipment.RequestedShipment.Recipient.Address.StreetLines = ['Address Line 1']
shipment.RequestedShipment.Recipient.Address.City = convert_to_utf8('TorontoåæâèéHerndon')
shipment.RequestedShipment.Recipient.Address.StateOrProvinceCode = 'VA'
shipment.RequestedShipment.Recipient.Address.PostalCode = '20171'
shipment.RequestedShipment.Recipient.Address.CountryCode = 'US'
shipment.RequestedShipment.EdtRequestType = 'NONE'
shipment.RequestedShipment.ShippingChargesPayment.Payor.ResponsibleParty.AccountNumber \
= CONFIG_OBJ.account_number
shipment.RequestedShipment.ShippingChargesPayment.PaymentType = 'SENDER'
shipment.RequestedShipment.LabelSpecification.LabelFormatType = 'COMMON2D'
shipment.RequestedShipment.LabelSpecification.ImageType = 'PNG'
shipment.RequestedShipment.LabelSpecification.LabelStockType = 'PAPER_7X4.75'
shipment.RequestedShipment.LabelSpecification.LabelPrintingOrientation = 'BOTTOM_EDGE_OF_TEXT_FIRST'
# Use order if setting multiple labels or delete
del shipment.RequestedShipment.LabelSpecification.LabelOrder
package1_weight = shipment.create_wsdl_object_of_type('Weight')
package1_weight.Value = 2.0
package1_weight.Units = "LB"
package1 = shipment.create_wsdl_object_of_type('RequestedPackageLineItem')
package1.PhysicalPackaging = 'ENVELOPE'
package1.Weight = package1_weight
shipment.add_package(package1)
shipment.send_validation_request()
shipment.send_request()
assert shipment.response
assert shipment.response.HighestSeverity == 'SUCCESS'
track_id = shipment.response.CompletedShipmentDetail.CompletedPackageDetails[0].TrackingIds[0].TrackingNumber
assert track_id
del_shipment = FedexDeleteShipmentRequest(CONFIG_OBJ)
del_shipment.DeletionControlType = "DELETE_ALL_PACKAGES"
del_shipment.TrackingId.TrackingNumber = track_id
del_shipment.TrackingId.TrackingIdType = 'EXPRESS'
del_shipment.send_request()
Get the Response¶
Once you perform send_request(), you can access the response attribute of the service request object. To access the response from the above delete shipment example:
request_response = del_shipment.response
Validate an Address¶
avs_request = FedexAddressValidationRequest(CONFIG_OBJ)
address1 = avs_request.create_wsdl_object_of_type('AddressToValidate')
address1.Address.StreetLines = ['155 Old Greenville Hwy', 'Suite 103']
address1.Address.City = 'Clemson'
address1.Address.StateOrProvinceCode = 'SC'
address1.Address.PostalCode = 29631
address1.Address.CountryCode = 'US'
address1.Address.Residential = False
avs_request.add_address(address1)
avs_request.send_request()
Estimate Delivery Time¶
avc_request = FedexAvailabilityCommitmentRequest(CONFIG_OBJ)
avc_request.Origin.PostalCode = 'M5V 3A4'
avc_request.Origin.CountryCode = 'CA'
avc_request.Destination.PostalCode = '27577' # 29631
avc_request.Destination.CountryCode = 'US'
Validate Postal Code¶
inquiry = FedexValidatePostalRequest(CONFIG_OBJ)
inquiry.Address.PostalCode = '29631'
inquiry.Address.CountryCode = 'US'
inquiry.send_request()
FedEx Store Search¶
location_request = FedexSearchLocationRequest(CONFIG_OBJ)
location_request.Address.PostalCode = '38119'
location_request.Address.CountryCode = 'US'
Get Package Rate¶
rate = FedexRateServiceRequest(CONFIG_OBJ)
rate.RequestedShipment.DropoffType = 'REGULAR_PICKUP'
rate.RequestedShipment.ServiceType = 'FEDEX_GROUND'
rate.RequestedShipment.PackagingType = 'YOUR_PACKAGING'
rate.RequestedShipment.Shipper.Address.StateOrProvinceCode = 'SC'
rate.RequestedShipment.Shipper.Address.PostalCode = '29631'
rate.RequestedShipment.Shipper.Address.CountryCode = 'US'
rate.RequestedShipment.Recipient.Address.StateOrProvinceCode = 'NC'
rate.RequestedShipment.Recipient.Address.PostalCode = '27577'
rate.RequestedShipment.Recipient.Address.CountryCode = 'US'
rate.RequestedShipment.EdtRequestType = 'NONE'
rate.RequestedShipment.ShippingChargesPayment.PaymentType = 'SENDER'
package1_weight = rate.create_wsdl_object_of_type('Weight')
package1_weight.Value = 1.0
package1_weight.Units = "LB"
package1 = rate.create_wsdl_object_of_type('RequestedPackageLineItem')
package1.Weight = package1_weight
package1.PhysicalPackaging = 'BOX'
package1.GroupPackageCount = 1
rate.add_package(package1)
rate.send_request()
Track a Package¶
track = FedexTrackRequest(CONFIG_OBJ)
tracking_num = '781820562774'
track.SelectionDetails.PackageIdentifier.Type = 'TRACKING_NUMBER_OR_DOORTAG'
track.SelectionDetails.PackageIdentifier.Value = tracking_num
track.send_request()
Get JSON and Dictionary Response¶
from fedex.tools.response_tools import sobject_to_dict
from fedex.tools.response_tools import sobject_to_json
response_dict = sobject_to_dict(shipment.response)
response_json = sobject_to_json(shipment.response)
Advanced Requests¶
Since this module is a suds wrapper, you can browse each service’s WSDL
in fedex/wsdls
and add any required objects to your request.
For example, the Ship Service WSDL has a simpleType definition for ServiceType with the following options:
'STANDARD_OVERNIGHT'
'PRIORITY_OVERNIGHT'
'FEDEX_GROUND'
'FEDEX_EXPRESS_SAVER'
'FEDEX_2_DAY'
'INTERNATIONAL_PRIORITY'
'SAME_DAY'
'INTERNATIONAL_ECONOMY'
You can see all what is available for a specific definition by browsing a service’s WSDL. It is possible to customize your request beyond what is included in the examples but still within the confines of this package. If it’s something common enough, please bring it forward so that it can be included along as an example.
Implemented Services¶
python-fedex implements various FedEx Web Services. These services along with the implemented functionality is described below.
Ship Service¶
Generates (FedEx Waybill) and deletes shipments.
-
class
fedex.services.ship_service.
FedexProcessShipmentRequest
(config_obj, *args, **kwargs)[source]¶ Bases:
fedex.base_service.FedexBaseService
This class allows you to process (create) a new FedEx shipment. You will need to populate the data structures in self.RequestedShipment, then send the request. Label printing is supported and very configurable, returning an ASCII representation with the response as well.
The optional keyword args detailed on L{FedexBaseService} apply here as well.
@type config_obj: L{FedexConfig} @param config_obj: A valid FedexConfig object.
-
add_package
(package_item)[source]¶ Adds a package to the ship request.
- @type package_item: WSDL object, type of RequestedPackageLineItem
- WSDL object.
- @keyword package_item: A RequestedPackageLineItem, created by
- calling create_wsdl_object_of_type(‘RequestedPackageLineItem’) on this ShipmentRequest object. See examples/create_shipment.py for more details.
-
create_wsdl_object_of_type
(type_name)¶ Creates and returns a WSDL object of the specified type. :param type_name: specifies the object’s type name from WSDL.
-
send_request
(send_function=None)¶ Sends the assembled request on the child object. @type send_function: function reference @keyword send_function: A function reference (passed without the
parenthesis) to a function that will send the request. This allows for overriding the default function in cases such as validation requests.
-
send_validation_request
()[source]¶ This is very similar to just sending the shipment via the typical send_request() function, but this doesn’t create a shipment. It is used to make sure “good” values are given by the user or the application using the library.
-
RequestedShipment
= None¶ @ivar: Holds the RequestedShipment WSDL object.
-
-
class
fedex.services.ship_service.
FedexDeleteShipmentRequest
(config_obj, *args, **kwargs)[source]¶ Bases:
fedex.base_service.FedexBaseService
This class allows you to delete a shipment, given a tracking number.
Deletes a shipment via a tracking number.
-
create_wsdl_object_of_type
(type_name)¶ Creates and returns a WSDL object of the specified type. :param type_name: specifies the object’s type name from WSDL.
-
send_request
(send_function=None)¶ Sends the assembled request on the child object. @type send_function: function reference @keyword send_function: A function reference (passed without the
parenthesis) to a function that will send the request. This allows for overriding the default function in cases such as validation requests.
-
DeletionControlType
= None¶ @ivar: Holds the DeletrionControlType WSDL object.
-
TrackingId
= None¶ @ivar: Holds the TrackingId WSDL object.
-
Rate Service¶
Calculates the cost of a shipment.
-
class
fedex.services.rate_service.
FedexRateServiceRequest
(config_obj, *args, **kwargs)[source]¶ Bases:
fedex.base_service.FedexBaseService
This class allows you to get the shipping charges for a particular address. You will need to populate the data structures in self.RequestedShipment, then send the request.
The optional keyword args detailed on L{FedexBaseService} apply here as well.
@type config_obj: L{FedexConfig} @param config_obj: A valid FedexConfig object.
-
add_package
(package_item)[source]¶ Adds a package to the ship request.
- @type package_item: WSDL object, type of RequestedPackageLineItem
- WSDL object.
- @keyword package_item: A RequestedPackageLineItem, created by
- calling create_wsdl_object_of_type(‘RequestedPackageLineItem’) on this ShipmentRequest object. See examples/create_shipment.py for more details.
-
create_wsdl_object_of_type
(type_name)¶ Creates and returns a WSDL object of the specified type. :param type_name: specifies the object’s type name from WSDL.
-
send_request
(send_function=None)¶ Sends the assembled request on the child object. @type send_function: function reference @keyword send_function: A function reference (passed without the
parenthesis) to a function that will send the request. This allows for overriding the default function in cases such as validation requests.
-
RequestedShipment
= None¶ @ivar: Holds the RequestedShipment WSDL object including the shipper, recipient and shipt time.
-
Validation Availability And Commitment Service¶
Calculates the estimated arrival time of a shipment.
-
class
fedex.services.availability_commitment_service.
FedexAvailabilityCommitmentRequest
(config_obj, *args, **kwargs)[source]¶ Bases:
fedex.base_service.FedexBaseService
This class allows you validate service availability
@type config_obj: L{FedexConfig} @param config_obj: A valid FedexConfig object.
-
create_wsdl_object_of_type
(type_name)¶ Creates and returns a WSDL object of the specified type. :param type_name: specifies the object’s type name from WSDL.
-
send_request
(send_function=None)¶ Sends the assembled request on the child object. @type send_function: function reference @keyword send_function: A function reference (passed without the
parenthesis) to a function that will send the request. This allows for overriding the default function in cases such as validation requests.
-
CarrierCode
= None¶ @ivar: Carrier Code Default to Fedex (FDXE), or can bbe FDXG.
-
Destination
= None¶ @ivar: Holds Destination Address WSDL object.
-
Origin
= None¶ @ivar: Holds Origin Address WSDL object.
-
Packaging
= None¶ @ivar: Type of packaging to narrow down available shipping options or defaults to YOUR_PACKAGING.
-
Service
= None¶ @ivar: Service type, if set to None will get all available service information.
-
ShipDate
= None¶ @ivar: Ship Date date WSDL object.
-
Track Service¶
Returns tracking information for a given tracking number.
-
class
fedex.services.track_service.
FedexTrackRequest
(config_obj, *args, **kwargs)[source]¶ Bases:
fedex.base_service.FedexBaseService
This class allows you to track shipments by providing a tracking number or other identifying features. By default, you can simply pass a tracking number to the constructor. If you would like to query shipments based on something other than tracking number, you will want to read the documentation for the L{__init__} method. Particularly, the tracking_value and package_identifier arguments.
Sends a shipment tracking request. The optional keyword args detailed on L{FedexBaseService} apply here as well.
@type config_obj: L{FedexConfig} @param config_obj: A valid FedexConfig object.
-
create_wsdl_object_of_type
(type_name)¶ Creates and returns a WSDL object of the specified type. :param type_name: specifies the object’s type name from WSDL.
-
send_request
(send_function=None)¶ Sends the assembled request on the child object. @type send_function: function reference @keyword send_function: A function reference (passed without the
parenthesis) to a function that will send the request. This allows for overriding the default function in cases such as validation requests.
-
ProcessingOptions
= None¶ @ivar: Holds the TrackRequestProcessingOptionType WSDL object that defaults no None.
-
SelectionDetails
= None¶ @ivar: Holds the SelectionDetails WSDL object that includes tracking type and value.
-
Address Validation Service¶
Validates and cleans a given address.
-
class
fedex.services.address_validation_service.
FedexAddressValidationRequest
(config_obj, *args, **kwargs)[source]¶ Bases:
fedex.base_service.FedexBaseService
This class allows you validate anywhere from one to a hundred addresses in one go. Create AddressToValidate WSDL objects and add them to each instance of this request using add_address().
@type config_obj: L{FedexConfig} @param config_obj: A valid FedexConfig object.
-
add_address
(address_item)[source]¶ Adds an address to self.AddressesToValidate.
@type address_item: WSDL object, type of AddressToValidate WSDL object. @keyword address_item: A AddressToValidate, created by
calling create_wsdl_object_of_type(‘AddressToValidate’) on this FedexAddressValidationRequest object. See examples/create_shipment.py for more details.
-
create_wsdl_object_of_type
(type_name)¶ Creates and returns a WSDL object of the specified type. :param type_name: specifies the object’s type name from WSDL.
-
send_request
(send_function=None)¶ Sends the assembled request on the child object. @type send_function: function reference @keyword send_function: A function reference (passed without the
parenthesis) to a function that will send the request. This allows for overriding the default function in cases such as validation requests.
-
AddressesToValidate
= None¶ @ivar: Holds the AddressToValidate WSDL object.
-
Location Service¶
Returns FedEx store locations based on a given location query.
-
class
fedex.services.location_service.
FedexSearchLocationRequest
(config_obj, *args, **kwargs)[source]¶ Bases:
fedex.base_service.FedexBaseService
This class allows you to figure out a FedEx location closest to a specified location criteria, based on location type. The response includes location details like operating times, directions and a map link and more.
@type config_obj: L{FedexConfig} @param config_obj: A valid FedexConfig object.
-
create_wsdl_object_of_type
(type_name)¶ Creates and returns a WSDL object of the specified type. :param type_name: specifies the object’s type name from WSDL.
-
send_request
(send_function=None)¶ Sends the assembled request on the child object. @type send_function: function reference @keyword send_function: A function reference (passed without the
parenthesis) to a function that will send the request. This allows for overriding the default function in cases such as validation requests.
-
Address
= None¶ @ivar: Holds the Address WSDL object.
-
Constraints
= None¶ @ivar: Holds a list of SearchLocationConstraints WSDL objects.
-
LocationsSearchCriterion
= None¶ @ivar: Holds the LocationsSearchCriteriaType WSDL object.
-
MultipleMatchesAction
= None¶ @ivar: Holds the MultipleMatchesActionType WSDL object.
-
PhoneNumber
= None¶ @ivar: Holds the PhoneNumber string object.
-
SortDetail
= None¶ @ivar: Holds the LocationSortDetail WSDL object.
-
Country Service¶
Validates the postal codes for a given address.
-
class
fedex.services.country_service.
FedexValidatePostalRequest
(config_obj, *args, **kwargs)[source]¶ Bases:
fedex.base_service.FedexBaseService
This class allows you validate an address. https://www.fedex.com/us/developer/WebHelp/ws/2015/html/WebServicesHelp/WSDVG/47_Country_Service.htm
@type config_obj: L{FedexConfig} @param config_obj: A valid FedexConfig object.
-
create_wsdl_object_of_type
(type_name)¶ Creates and returns a WSDL object of the specified type. :param type_name: specifies the object’s type name from WSDL.
-
send_request
(send_function=None)¶ Sends the assembled request on the child object. @type send_function: function reference @keyword send_function: A function reference (passed without the
parenthesis) to a function that will send the request. This allows for overriding the default function in cases such as validation requests.
-
Address
= None¶ @ivar: Holds Address WSDL objects.
-
CarrierCode
= None¶ @ivar: Carrier Code Default to Fedex (FDXE), or can bbe FDXG.
-
CheckForMismatch
= None¶ @ivar: Holds the CheckForMismatch boolean objects.
-
RoutingCode
= None¶ @ivar: Routing Code Default to FDSD.
-
ShipDateTime
= None¶ @ivar: Holds the ShipDateTime date time objects.
-
Pickup Service¶
Creates a fedex pickup request.
-
class
fedex.services.pickup_service.
FedexCreatePickupRequest
(config_obj, *args, **kwargs)[source]¶ Bases:
fedex.base_service.FedexBaseService
-
create_wsdl_object_of_type
(type_name)¶ Creates and returns a WSDL object of the specified type. :param type_name: specifies the object’s type name from WSDL.
-
send_request
(send_function=None)¶ Sends the assembled request on the child object. @type send_function: function reference @keyword send_function: A function reference (passed without the
parenthesis) to a function that will send the request. This allows for overriding the default function in cases such as validation requests.
-
Package Movement Service¶
DEPRECATED service that was used to validate postal codes and calculate shipment arrival times. Replaced with two distinct services: Validation Availability And Commitment Service, and Country Service.
-
class
fedex.services.country_service.
FedexValidatePostalRequest
(config_obj, *args, **kwargs)[source] Bases:
fedex.base_service.FedexBaseService
This class allows you validate an address. https://www.fedex.com/us/developer/WebHelp/ws/2015/html/WebServicesHelp/WSDVG/47_Country_Service.htm
@type config_obj: L{FedexConfig} @param config_obj: A valid FedexConfig object.
-
create_wsdl_object_of_type
(type_name) Creates and returns a WSDL object of the specified type. :param type_name: specifies the object’s type name from WSDL.
-
send_request
(send_function=None) Sends the assembled request on the child object. @type send_function: function reference @keyword send_function: A function reference (passed without the
parenthesis) to a function that will send the request. This allows for overriding the default function in cases such as validation requests.
-
Address
= None @ivar: Holds Address WSDL objects.
-
CarrierCode
= None @ivar: Carrier Code Default to Fedex (FDXE), or can bbe FDXG.
-
CheckForMismatch
= None @ivar: Holds the CheckForMismatch boolean objects.
-
RoutingCode
= None @ivar: Routing Code Default to FDSD.
-
ShipDateTime
= None @ivar: Holds the ShipDateTime date time objects.
-
Format Conversion Tools¶
Additional utility functions for converting suds xml object into other formats.
Basic Suds Object to Dictionary¶
Advanced Suds Object to Dictionary¶
-
fedex.tools.conversion.
sobject_to_dict
(obj, key_to_lower=False, json_serialize=False)[source]¶ Converts a suds object to a dict. Includes advanced features. :param json_serialize: If set, changes date and time types to iso string. :param key_to_lower: If set, changes index key name to lower case. :param obj: suds object :return: dict object
Config Object¶
A standardized configuration container object used by python-fedex.
-
class
fedex.config.
FedexConfig
(key, password, account_number=None, meter_number=None, freight_account_number=None, integrator_id=None, wsdl_path=None, express_region_code=None, use_test_server=False)[source]¶ Bases:
object
Base configuration class that is used for the different Fedex SOAP calls. These are generally passed to the Fedex request classes as arguments. You may instantiate a L{FedexConfig} object with the minimal C{key} and C{password} arguments and set the instance variables documented below at a later time if you must.
@type key: L{str} @param key: Developer test key. @type password: L{str} @param password: The Fedex-generated password for your Web Systems
account. This is generally emailed to you after registration.@type account_number: L{str} @keyword account_number: The account number sent to you by Fedex after
registering for Web Services.@type meter_number: L{str} @keyword meter_number: The meter number sent to you by Fedex after
registering for Web Services.@type freight_account_number: L{str} @keyword freight_account_number: The freight account number sent to you
by Fedex after registering for Web Services.@type integrator_id: L{str} @keyword integrator_id: The integrator string sent to you by Fedex after
registering for Web Services.@type wsdl_path: L{str} @keyword wsdl_path: In the event that you want to override the path to
your WSDL directory, do so with this argument.@type use_test_server: L{bool} @keyword use_test_server: When this is True, test server WSDLs are used
instead of the production server. You will also need to make sure that your L{FedexConfig} object has a production account number, meter number, authentication key, and password.-
account_number
= None¶ @ivar: Web Services account number.
-
express_region_code
= None¶ @ivar: Web services ExpressRegionCode
-
freight_account_number
= None¶ @ivar: Web Services freight accountnumber.
-
integrator_id
= None¶ @ivar: Web services integrator ID.
-
key
= None¶ @ivar: Developer test key.
-
meter_number
= None¶ @ivar: Web services meter number.
-
password
= None¶ @ivar: Fedex Web Services password.
-
use_test_server
= None¶ @ivar: When True, point to the test server.
-
Base Service Class¶
-
class
fedex.base_service.
FedexBaseService
(config_obj, wsdl_name, *args, **kwargs)[source]¶ Bases:
object
This class is the master class for all Fedex request objects. It gets all of the common SOAP objects created via suds and populates them with values from a L{FedexConfig} object, along with keyword arguments via L{__init__}.
- @note: This object should never be used directly, use one of the included
- sub-classes.
This constructor should only be called by children of the class. As is such, only the optional keyword arguments caught by C{**kwargs} will be documented.
@type customer_transaction_id: L{str} @keyword customer_transaction_id: A user-specified identifier to
differentiate this transaction from others. This value will be returned with the response from Fedex.-
create_wsdl_object_of_type
(type_name)[source]¶ Creates and returns a WSDL object of the specified type. :param type_name: specifies the object’s type name from WSDL.
-
send_request
(send_function=None)[source]¶ Sends the assembled request on the child object. @type send_function: function reference @keyword send_function: A function reference (passed without the
parenthesis) to a function that will send the request. This allows for overriding the default function in cases such as validation requests.
-
ClientDetail
= None¶ @ivar: WSDL object that holds client account details.
-
TransactionDetail
= None¶ @ivar: Holds customer-specified transaction IDs.
-
VersionId
= None¶ @ivar: Holds details on the version numbers of the WSDL.
-
WebAuthenticationDetail
= None¶ @ivar: WSDL object that holds authentication info.
-
config_obj
= None¶ @ivar: The FedexConfig object to pull auth info from.
-
logger
= None¶ @ivar: Python logger instance with name ‘fedex’.
-
response
= None¶ @ivar: The response from Fedex. You will want to pick what you want out here here. This object does have a __str__() method, you’ll want to print or log it to see what possible values you can pull.
Exception Classes¶
python-fedex implements various custom exceptions.
Fedex Base Service Exception¶
-
class
fedex.base_service.
FedexBaseServiceException
(error_code, value)[source]¶ Bases:
exceptions.Exception
Exception: Serves as the base exception that other service-related exception objects are sub-classed from.
Fedex Failure¶
-
class
fedex.base_service.
FedexFailure
(error_code, value)[source]¶ Bases:
fedex.base_service.FedexBaseServiceException
Exception: The request could not be handled at this time. This is generally a server problem.
Fedex Error¶
-
class
fedex.base_service.
FedexError
(error_code, value)[source]¶ Bases:
fedex.base_service.FedexBaseServiceException
Exception: These are generally problems with the client-provided data.
General Suds Plugin¶
python-fedex uses the following suds plugin for suds xml requests.
-
class
fedex.base_service.
GeneralSudsPlugin
(**kwargs)[source]¶ Bases:
suds.plugin.MessagePlugin
General Suds Plugin: Adds logging request and response functionality and prunes empty WSDL objects before sending.
Initializes the request and response loggers.
-
parsed
(context)¶ Suds has sax parsed the received reply. Provides the plugin with the opportunity to inspect/modify the sax parsed DOM tree for the reply before it is unmarshalled. @param context: The reply context.
The I{reply} is DOM tree.@type context: L{MessageContext}
-
unmarshalled
(context)¶ Suds has unmarshalled the received reply. Provides the plugin with the opportunity to inspect/modify the unmarshalled reply object before it is returned. @param context: The reply context.
The I{reply} is unmarshalled suds object.@type context: L{MessageContext}
-
Change Log¶
2.4.0¶
- Pickup Service usingv11 WSDL (hornedbull)
- Added documentation and unit tests for Pickup Service. (radzhome)
- Update package data to include tools (noodlebreak)
2.3.0¶
- Added Location Service using v3 WSDL. (radzhome)
- Added examples and unit tests for Location Service. (radzhome)
- Updated certification process scripts to work with latest WSDLs. (radzhome)
- Added warning logging for requests that come back with warning notes. (radzhome)
- Added PyPI, Travis, requires.io integration/badges. (radzhome)
- Organization change from gtaylor to python-fedex-devs. (gtaylor)
- Added deprecation message for movement service. (radzhome)
- Added conversion tools to convert suds xml object into python dict. (radzhome)
- Redirect logging to stdout for examples and tests when not ran via nose. (radzhome)
2.2.0¶
- Added Country Service / Postal Code Validation service. (radzhome)
- Added CountryService_v4.wsdl for Postal Code Validation. (radzhome)
- Added unit tests and examples for Country service. (radzhome)
- Added Signature Option to ship example. (radzhome)
- Fix base service logging request and response. (radzhome)
2.1.0¶
- Added Validation, Availability and Commitment (AVC) service. (radzhome)
- Added [Validation]AvailabilityAndCommitmentService_v4.wsdl for AVC service. (radzhome)
- Added examples and unit tests for AVC service.
- Refactored examples and documentation. (radzhome)
- A quick PEP8 pass using pycharm on most of the codebase (radzhome)
- Add travis yml (radzhome)
2.0.0¶
- Bump ShipService WSDL to v17 for create and delete shipment. (radzhome)
- Bump AddressValidation WSDL to v4. (radzhome)
- Bump RateService WSDL to v18. (radzhome)
- Bump TrackService WSDL to v10. (radzhome)
- General improvements to base class. (radzhome)
- Refactoring and updates to examples. (radzhome)
- Added test classes. (radzhome)
- Remove old and unused WSDLs. (radzhome)
- Change dependency to suds-jurko to include python 3 support. (radzhome)
1.1.1¶
- Made RateService_v16.wsdl point at ws.fedex.com instead of wsbeta.fedex.com. Fixes issues in production. (ikks)
1.1.0¶
- A quick PEP8 pass on most of the codebase. Yucky. (gtaylor)
- Changing recommended install method to use pip + PyPi. (radzhome)
- Updated rate_request and freight_rate_request examples for WSDL v16 compatibility. (foxxyz)
- Updated rate service WSDL from v8 to v16. (foxxyz)
- Added a freight rate request example (mwcbrent)
- Bump ShipService WSDL to v13. (mwcbrent)
- Update rate example to show multiple ServiceTypes. (danielatdattrixdotcom)
1.0.14¶
- Re-licensed under BSD.
1.0.12 and 1.0.13¶
- Forget that these ever existed.
1.0.11¶
- Bug fix of a bug fix for regions config. (jcartmell)
1.0.10¶
- Bug fix regarding regions and when they are sent. (jcartmell)
1.0.9¶
- Various fixes to RateRequest() FedEx API call. (jcartmell)
- Added this changelog. (gtaylor)
1.0.8¶
- Fixed some problems with the unit tests. (gtaylor)
1.0.7¶
- Fixed a bug with international rate request example. (gtaylor)
1.0.6¶
- Lots of documentation improvements. (gtaylor)
- FedEx RateRequest call implemented. (yahtib)
- FedEx Postal Inquiry call implemented. (yahtib)
1.0.4¶
- Removal of unecessary files. (gtaylor)
- Documentation improvements. (gtaylor)