A light wrapper around FedEx's SOAP API.

Overview

Python FedEx SOAP API Module

https://travis-ci.org/python-fedex-devs/python-fedex.svg?branch=master Requirements Status Documentation Status
Author: Greg Taylor, Radek Wojcik
Maintainer: Python FedEx Developers
License: BSD
Status: Stable

What is it?

A light wrapper around FedEx's Webservice Soap API. We don't do much of any validation, but we'll help you sort through the pile of SOAP objects FedEx uses.

Installation

The easiest way is via pip or easy_install:

pip install fedex

Quick Start

  • Clone this repository.
  • Edit the example_config.py file in See examples/ with your fedex credentials and run any of the provided examples.

Documentation

Refer to the documentation for more details on the project. Latest doc builds are found in docs and doc build scripts in doc_source. Sphinx documentation is in doc_src.

There are also a lot of useful examples under the examples directory within this directory.

Support

Issues & Questions: https://github.com/gtaylor/python-fedex/issues

Most problems are going to require investigation or a submitted pull request by someone from the Python FedEx Developers organization. To contribute a new feature or service, feel free to create a pull request. We are always looking for new contributors to help maintain the project.

Fedex Support and Documentation

Fedex Support Email: [email protected]

Developer Portal: http://www.fedex.com/us/developer/

Updates To Services: https://www.fedex.com/us/developer/web-services/process.html (FedEx Web Services Announcements)

Related Projects

Todos

  • Increase service specific request validation
  • Remove deprecated services (package movement service)
  • Pickup service unit tests

Legal

Copyright (C) 2008-2015 Greg Taylor

Copyright (C) 2015-2016 Python FedEx Developers

This software is licensed under the BSD License.

python-fedex is not authored by, endorsed by, or in any way affiliated with FedEx.

Comments
  • FedEx may have moved their web services test API

    FedEx may have moved their web services test API

    I just signed up to get started, and I am quite excited about the software you put together.

    But I am unable to get a successful response from FedEx. I copied & pasted examples/create_shipment.py and examples/example_config.py and filled in my own values. I then tried to run the example using my test key/password/etc and got this error message:

    Traceback (most recent call last): File "testfedex.py", line 113, in shipment.send_validation_request() File "/usr/local/lib/python2.6/dist-packages/fedex/services/ship_service.py", line 102, in send_validation_request self.send_request(send_function=self._assemble_and_send_validation_request) File "/usr/local/lib/python2.6/dist-packages/fedex/base_service.py", line 226, in send_request self._check_response_for_request_errors() File "/usr/local/lib/python2.6/dist-packages/fedex/base_service.py", line 188, in _check_response_for_request_errors notification.Message) fedex.base_service.FedexError: Authentication Failed (Error code: 1000) sandford@Compy686:~/workspace/labels/fedex$

    I thought that the problem might be related to the validation I was asking it to do (I uncommented the "validate this request" line). So I removed the validation, and was greeted with this:

    Traceback (most recent call last): File "testfedex.py", line 116, in shipment.send_request() File "/usr/local/lib/python2.6/dist-packages/fedex/base_service.py", line 219, in send_request raise SchemaValidationError() fedex.base_service.SchemaValidationError: "suds encountered an error validating your data against this service's WSDL schema. Please double-check for missing or invalid values, filling all required fields." (Error code: -1) sandford@Compy686:~/workspace/labels/fedex$

    That's not so good, since I was hoping to use the example to get started.

    I went back to the previous error (authentication failed) and did a little digging. The WSDL files show the URL being something like https://gatewaybeta.fedex.com:443/web-services but in an email FedEx sent me with my test account information they list https://wsbeta.fedex.com:443/web-services. I can't help but wonder if that cased the authentication problem I first noted.

    In the interests of figuring out what the problem was with the create_shipment request (sans validation) I found this on SO (http://stackoverflow.com/questions/2388046/can-you-help-me-solve-this-suds-soap-issue) and cranked logging up to DEBUG. I found this: <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><ns1:Header xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns0="http://fedex.com/ws/ship/v7" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/><ns1:Body xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns0="http://fedex.com/ws/ship/v7" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">soapenv:Faultsoapenv:ServerSchema validation failed for request.<con:fault xmlns:con="http://www.bea.com/wli/sb/context">con:errorCode5/con:errorCodecon:reasonSchema validation failed for request./con:reasoncon:details<con1:ValidationFailureDetail xmlns:con1="http://www.bea.com/wli/sb/stages/transform/config">con1:messagestring value '' is not a valid enumeration value for EdtRequestType in namespace http://fedex.com/ws/ship/v7/con1:messagecon1:xmlLocationns0:EdtRequestType//con1:xmlLocationcon1:messagestring value '' is not a valid enumeration value for PhysicalPackagingType in namespace http://fedex.com/ws/ship/v7/con1:messagecon1:xmlLocationns0:PhysicalPackaging//con1:xmlLocation/con1:ValidationFailureDetail/con:details/con:fault/soapenv:Fault/ns1:Body/soapenv:Envelope The important bit there seems to be this: string value '' is not a valid enumeration value for EdtRequestType in namespace http://fedex.com/ws/ship/v7

    Then I go to http://www.fedex.com/ws/ship/v7 and FedEx gives me a 404 error.

    I am basically out of ideas on how to debug these issues at this point. Any help you can give me would be greatly appreciated.

    Thanks! Mike

    opened by MikeSandford 11
  • Recipient phone numbers required?

    Recipient phone numbers required?

    I work at a place that ships stuff using the Fedex Shipping Manager software. It does not seem to need a recipient phone number, but this module does. Am I doing something wrong? Should I give a number like "###-###-####" or "000-000-0000" or something?

    opened by nathanielstenzel 10
  • Next release date?

    Next release date?

    Hey folks, first of all, thank you for maintaining this library.

    The currently released version is quite old and some features don't work on the released WSDLs like the direct signature requirement. Is there a planned release date on pypi for the next release?

    opened by sharoonthomas 8
  • Find fedex tracking id by sender reference

    Find fedex tracking id by sender reference

    Hi

    Is there a way with this library to find tracking numbers from our account / reference number ?

    We have several places of label creation etc (some online) and would like to recover the tracking ID's to our back office system.

    Is this possible ?

    Thanks

    Alex

    opened by Bobspadger 8
  • TrackingRequest incorrectly constructed from v10 WSDL

    TrackingRequest incorrectly constructed from v10 WSDL

    Was trying to track a package by reference number today. Found it to be impossible.

    I need to send country in this field along with the account number: track.SelectionDetails.Destination

    It should accept Address objects. It incorrectly expects a string. Adding the proper type causes a SchemaValidationError. Sending anything else to Fedex produces a failure in their system.

    opened by mmangione 7
  • 'Meter number is not registered (Error code: 8001)' in production

    'Meter number is not registered (Error code: 8001)' in production

    Hello, i am triying go to production, with use_test_server=False and date productions for meter number and more, but fedex create_shipment display: 'Meter number is not registered (Error code: 8001)'.

    Help me please, thank you

    opened by ma1onso 7
  • Update dependency to support suds-community

    Update dependency to support suds-community

    This PR attempts to resolve issue #158

    While building with the latest version of fedex our ci/cd process breaks while attempting to install the dependency suds-jurko.

    ERROR: Command errored out with exit status 1:
         command: /usr/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-i40r_jb8/suds-jurko/setup.py'"'"'; __file__='"'"'/tmp/pip-install-i40r_jb8/suds-jurko/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-install-i40r_jb8/suds-jurko/pip-egg-info
             cwd: /tmp/pip-install-i40r_jb8/suds-jurko/
        Complete output (1 lines):
        error in suds-jurko setup command: use_2to3 is invalid.
    

    Upon further examination it turns out that python's setuptools drops support for 2to3 in version v.58.0.0. In order to correct this it is recommended to switch to the new and actively maintained package suds-community which already has resolved this problem HERE.

    Closes #158

    I have also opted to pin this dependency for future cases where the project can be more intentional with the versions expected.

    opened by ndobbs 6
  • Switch project required dependency to suds-community.

    Switch project required dependency to suds-community.

    PR #159 attempts to resolve this issue.

    While building with the latest version of fedex our ci/cd process breaks while attempting to install the dependency suds-jurko.

    ERROR: Command errored out with exit status 1:
         command: /usr/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-i40r_jb8/suds-jurko/setup.py'"'"'; __file__='"'"'/tmp/pip-install-i40r_jb8/suds-jurko/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-install-i40r_jb8/suds-jurko/pip-egg-info
             cwd: /tmp/pip-install-i40r_jb8/suds-jurko/
        Complete output (1 lines):
        error in suds-jurko setup command: use_2to3 is invalid.
    

    Upon further examination it turns out that python's setuptools drops support for 2to3 in version v.58.0.0. In order to correct this it is recommended to switch to the new and actively maintained package suds-community which already has resolved this problem HERE.

    I have also opted to pin this dependency for future cases where the project can be more intentional with the versions expected.

    opened by ndobbs 6
  • calling shipment.add_package more than once results in

    calling shipment.add_package more than once results in "Invalid package count or invalid package sequence number. (Error code: 2021)"

    When I call shipment.add_package more than once, it appears that the api is sent <ns0:PackageCount>0</ns0:PackageCount>, and the response includes <Code>2021</Code><Message>Invalid package count or invalid package sequence number.</Message>.

    opened by preston-wagner 6
  • Install problem

    Install problem

    I installed with easy_install. Seemed to work but the module is empty.

    $ python Python 2.7.1 (r271:86832, Mar 4 2011, 16:49:28) [GCC 4.4.5] on linux2 Type "help", "copyright", "credits" or "license" for more information.

    import fedex dir(fedex) ['VERSION', 'builtins', 'doc', 'file', 'name', 'package', 'path']

    opened by johnmudd 6
  • This tracking number cannot be found. (Error Code: 9040)

    This tracking number cannot be found. (Error Code: 9040)

    Hello, I was using track service with right tracking_number.Request was successfully processed.But I got an error code :9040; And the DeliveryOptionEligibilityDetails in response is like this:

    (DeliveryOptionEligibilityDetail){
       Option = "REDIRECT_TO_HOLD_AT_LOCATION"
       Eligibility = "INELIGIBLE"
    

    Is it mean that some problems in my CONFIG_OBJ? Thanks a lot

    opened by flyysoul 5
  • FedEx RESTful API

    FedEx RESTful API

    Hello, Thank you for your help. I received the following email from FedEx.

    "Migrate to the FedEx RESTful API by February 28, 2024 before FedEx Web Services is retired."

    Do you have any plans to release a FedEx RESTful API version?

    opened by zesriver 0
  • Cannot install with setuptools>=58.0.2

    Cannot install with setuptools>=58.0.2

    Setuptools 58.0.2 fails fast when installing packages that want 2to3. https://github.com/pypa/setuptools/issues/2769

    $ /var/app/venv/staging-LQM1lest/bin/pip list setuptools
    Package    Version
    ---------- -------
    gunicorn   20.1.0
    pip        22.2.1
    setuptools 63.2.0
    wheel      0.37.1
    
    $ /var/app/venv/staging-LQM1lest/bin/pip install fedex==2.4.1
    Collecting fedex==2.4.1
      Using cached fedex-2.4.1.tar.gz (280 kB)
      Preparing metadata (setup.py) ... done
    Collecting suds-jurko
      Using cached suds-jurko-0.6.zip (255 kB)
      Preparing metadata (setup.py) ... error
      error: subprocess-exited-with-error
    
      × python setup.py egg_info did not run successfully.
      │ exit code: 1
      ╰─> [1 lines of output]
          error in suds-jurko setup command: use_2to3 is invalid.
          [end of output]
    
      note: This error originates from a subprocess, and is likely not a problem with pip.
    error: metadata-generation-failed
    
    × Encountered error while generating package metadata.
    ╰─> See above for output.
    
    note: This is an issue with the package mentioned above, not pip.
    hint: See above for details.
    
    opened by KJSanchez 2
  • Regression: rate_request.RequestedShipment.FreightShipmentDetail is None

    Regression: rate_request.RequestedShipment.FreightShipmentDetail is None

    I have an app that has been using this package for years without problems.

    Now I need to make a change, I created a new environment installing from git (see https://github.com/python-fedex-devs/python-fedex/issues/163), I ran a test which has the first part identical to freight_rate_request.py, but it fails at line 30 complaining that FreightShipmentDetail is None https://github.com/python-fedex-devs/python-fedex/blob/a3c5b7d0f03eaa883f91197d037a7af2e940da57/examples/freight_rate_request.py#L30

    Comparing the execution of the test on the old computer with fedex 2.4.0 installed with from pypi a few years ago to the execution on the new computer with fedex 2.4.1 installed from git today, it looks like the difference is on line 53 of rate_service.py: https://github.com/python-fedex-devs/python-fedex/blob/a3c5b7d0f03eaa883f91197d037a7af2e940da57/fedex/services/rate_service.py#L53

    After executing that line on the old computer the self.RequestedShipment has many members, and the value of most members is not None.

    After executing that line on the new computer the self.RequestedShipment has many members, and the value of most members is None.

    opened by stenci 1
  • Installation

    Installation

    How can I install this module using suds in lieu of suds-jurko? suds-jurko is very outdated and I can't get it to install on modern python but I can get suds to install. When suds-jurko fails the entire fedex package fails.

    opened by jerodg 1
  • Authentication Failed using use_test_server=True

    Authentication Failed using use_test_server=True

    Hello, hope it is not too silly to ask this question -

    I got the "Authentication Failed" when I run this FedexAddressValidationRequest module with the setting of "use_test_server=True" in FedexConfig, along with Test Key and Secret.

    I don't think it is Key and Secret issue as I'm able to use the same Key and Secret to get token by calling against test server https://apis-sandbox.fedex.com/oauth/token (see https://developer.fedex.com/api/en-us/catalog/authorization/v1/docs.html),

    So what do I need to do to run FedexAddressValidationRequest against test sever?

    ================================================== FedexError Traceback (most recent call last) in 9 avs_request.add_address(address1) 10 ---> 11 avs_request.send_request()

    ~\anaconda3\lib\site-packages\fedex\base_service.py in send_request(self, send_function) 329 # Check the response for errors specific to the particular request. 330 # This method can be overridden by a method on the child class object. --> 331 self._check_response_for_request_errors() 332 333 # Check the response for errors specific to the particular request.

    ~\anaconda3\lib\site-packages\fedex\base_service.py in _check_response_for_request_errors(self) 262 for notification in self.response.Notifications: 263 if notification.Severity == "ERROR": --> 264 raise FedexError(notification.Code, 265 notification.Message) 266

    FedexError: Authentication Failed (Error code: 1000)

    opened by randyhao-us 0
Releases(2.4.1)
  • 2.4.1(Feb 20, 2020)

  • 2.4.0(Oct 6, 2016)

    • Pickup Service usingv11 WSDL (hornedbull)
    • Added documentation and unit tests for Pickup Service. (radzhome)
    • Update package data to include tools (noodlebreak)
    Source code(tar.gz)
    Source code(zip)
  • 2.3.1(Jan 31, 2016)

    • Set fedex logging to INFO for tests. (radzhome)
    • Sphinx documentation (hosted on read the docs). (radzhome)
    • Update Ship Service test to allow warnings. (radzhome)
    • Added log warning for requests that yield a WARNING. (radzhome)
    Source code(tar.gz)
    Source code(zip)
  • 2.3.0(Jan 29, 2016)

    • 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)
    Source code(tar.gz)
    Source code(zip)
  • 2.2.0(Jan 16, 2016)

    • 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)
    Source code(tar.gz)
    Source code(zip)
  • 2.1.0(Jan 6, 2016)

    • 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)
    Source code(tar.gz)
    Source code(zip)
  • 2.0.0(Jan 6, 2016)

    • 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)
    Source code(tar.gz)
    Source code(zip)
  • 1.1.1(Mar 3, 2015)

  • 1.1.0(Feb 6, 2015)

    • 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)
    Source code(tar.gz)
    Source code(zip)
  • 1.0.14(Feb 6, 2015)

  • 1.0.12(Feb 6, 2015)

  • 1.0.11(Feb 6, 2015)

  • 1.0.10(Feb 6, 2015)

  • 1.0.9(Feb 6, 2015)

  • 1.0.8(Feb 6, 2015)

An API wrapper around the pythonanywhere's API.

pyaww An API wrapper around the pythonanywhere's API. The name stands for pythonanywherewrapper. 100% api coverage most of the codebase is documented

null 7 Dec 11, 2022
An API wrapper around Discord API.

NeoCord This project is work in progress not for production use. An asynchronous API wrapper around Discord API written in Python. Features Modern API

Izhar Ahmad 14 Jan 3, 2022
An API wrapper around the pythonanywhere's API.

pyaww An API wrapper around the pythonanywhere's API. The name stands for pythonanywherewrapper. 100% API coverage Most of the codebase is documented

null 7 Dec 11, 2022
Change between dark/light mode depending on the ambient light intensity

svart Change between dark/light mode depending on the ambient light intensity Installation Install using pip $ python3 -m pip install --user svart Ins

Siddharth Dushantha 169 Nov 26, 2022
Create light scenes , voice control, ifttt, fuzzywuzzy speech correction and much more with Tuya light bulbs.

LightBox Features: Auto discover tuya lights Set and create moods (aka: light profiles) Change moods via IFTTT List moods via IFTTT FuzzyWuzzy, speech

Robert Nagtegaal 1 Dec 20, 2021
Wrapper around the Mega API

python-mega Overview Wrapper around the Mega API. Based on the work of Julien Marchand. Installation Install using pip, including any optional package

Juan Riaza 104 Nov 26, 2022
A Python wrapper around the OpenWeatherMap web API

PyOWM A Python wrapper around OpenWeatherMap web APIs What is it? PyOWM is a client Python wrapper library for OpenWeatherMap (OWM) web APIs. It allow

Claudio Sparpaglione 740 Dec 18, 2022
A Python wrapper around the Soundcloud API

soundcloud-python A friendly wrapper around the Soundcloud API. Installation To install soundcloud-python, simply: pip install soundcloud Or if you'r

SoundCloud 83 Dec 12, 2022
Wrapper around the latest Tuenti API

python-tuenti Overview Wrapper around the latest Tuenti API. Installation Install using pip, including any optional packages you want... $ pip install

Juan Riaza 10 Mar 7, 2022
A Python wrapper around the Twitter API.

Python Twitter A Python wrapper around the Twitter API. By the Python-Twitter Developers Introduction This library provides a pure Python interface fo

Mike Taylor 3.4k Jan 1, 2023
Wrapper around the UPS API for creating shipping labels and fetching a package's tracking status.

ClassicUPS: A Useful UPS Library ClassicUPS is an Apache2 Licensed wrapper around the UPS API for creating shipping labels and fetching a package's tr

Jay Goel 55 Dec 12, 2022
A Python wrapper around the Twitter API.

Python Twitter A Python wrapper around the Twitter API. By the Python-Twitter Developers Introduction This library provides a pure Python interface fo

Mike Taylor 3.4k Jan 1, 2023
An asyncio Python wrapper around the Discord API, forked off of Rapptz's Discord.py.

Novus A modern, easy to use, feature-rich, and async ready API wrapper for Discord written in Python. A full fork of Rapptz's Discord.py library, with

Voxel Fox 60 Jan 3, 2023
An async-ready Python wrapper around FerrisChat's API.

FerrisWheel An async-ready Python wrapper around FerrisChat's API. Installation Instructions Linux: $ python3.9 -m pip install -U ferriswheel Python 3

FerrisChat 8 Feb 8, 2022
A Python wrapper around the Pushbullet API to send different types of push notifications to your phone or/and computer.

pushbullet-python A Python wrapper around the Pushbullet API to send different types of push notifications to your phone or/and computer. Installation

Janu Lingeswaran 1 Jan 14, 2022
light wrapper for indeed.com api

Simple wrapper for indeed api. go to indeed.com - register for api publisher token example from indeed import IndeedApi token = 'your token' api =

null 16 Sep 21, 2022
🚀 An asynchronous python API wrapper meant to replace discord.py - Snappy discord api wrapper written with aiohttp & websockets

Pincer An asynchronous python API wrapper meant to replace discord.py ❗ The package is currently within the planning phase ?? Links |Join the discord

Pincer 125 Dec 26, 2022
RichWatch is wrapper around AWS Cloud Watch to display beautiful logs with help of Python library Rich.

RichWatch is TUI (Textual User Interface) for AWS Cloud Watch. It formats and pretty prints Cloud Watch's logs so they are much more readable. Because

null 21 Jul 25, 2022
Aws-lambda-requests-wrapper - Request/Response wrapper for AWS Lambda with API Gateway

AWS Lambda Requests Wrapper Request/Response wrapper for AWS Lambda with API Gat

null 1 May 20, 2022