Skip to main content

Client library for the Duffel API

Project description

PyPI Supported Python versions Build Status Code style:black Downloads


Python client library for the Duffel API.


  • Python 3.7+

Getting started

pip install duffel-api


You first need to set the API token you can find in the Duffel dashboard under the section Developers > Access Tokens.

Once you have the token, you can call Duffel() with the value:

from duffel_api import Duffel

access_token = 'test_...'
client = Duffel(access_token = access_token)

After you have a client you can interact with, you can make calls to the Duffel API:

from duffel_api import Duffel

client = Duffel(access_token = 'test...')

offer_requests = client.offer_requests.list()
for offer_request in offer_requests:

You can find a complete example of booking a flight in ./examples/



Run all the tests:


As part of running tox, a code coverage report is built for you. You can navigate it by opening htmlcov/index.html in a browser, or if in a OS that supports it by using open (alternative xdg-open):

open ./htmlcov/index.html


Setup pypi config (~/.pypirc):

  username = __token__
  password = pypi-generated-token

  username = __token__
  password = pypi-generated-token

Install dependencies:

pip install wheel twine

Build the package before uploading:

python sdist bdist_wheel

Upload packages (test):

twine upload -r testpypi --verbose dist/*

The above will upload the packages to which will allow you to verify all is well with your upload before uploading it to the main pypi repository.

twine upload -r pypi --verbose dist/*

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

duffel-api-0.4.2.tar.gz (35.0 kB view hashes)

Uploaded Source

Built Distribution

duffel_api-0.4.2-py3-none-any.whl (64.4 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page