duffel-api
Python client library for the Duffel API.
Requirements
- Python 3.8+
Getting started
pip install duffel-api
Usage
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:
print(offer_request.id)
You can find a complete example of booking a flight in ./examples/book-flight.py.
Development
Testing
Run all the tests:
tox
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
Packaging
Setup pypi config (~/.pypirc):
[pypi]
username = __token__
password = pypi-generated-token
[testpypi]
username = __token__
password = pypi-generated-token
Install dependencies:
pip install wheel twine
Build the package before uploading:
python setup.py sdist bdist_wheel
Upload packages (test):
twine upload -r testpypi --verbose dist/*
The above will upload the packages to test.pypi.org 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/*
Metadata
Release files for duffel-api 0.6.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| duffel-api-0.6.2.tar.gz | 38.4 kB | Without provenance | Details for duffel-api-0.6.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| duffel_api-0.6.2-py3-none-any.whl | Python 3 | none | any | Details for duffel_api-0.6.2-py3-none-any.whl |
Total release size: 107.0 kB
Release files / duffel-api-0.6.2.tar.gz
| Download URL | duffel-api-0.6.2.tar.gz |
|---|---|
| Size | 38.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
663aa5fd55379a75146a9dc86bc5144ea2895c37a9898edc4df3a0e65360ad53
|
|
BLAKE2b-256 checksum How to use checksums |
169bd57c89203ad7c3de80fad45a9d0c6f86f6206adf4956b74bbbf49bb4c358
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.18
|
Release files / duffel_api-0.6.2-py3-none-any.whl
| Download URL | duffel_api-0.6.2-py3-none-any.whl |
|---|---|
| Size | 68.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c60f09d0d76c7ee872060ff6722b146bc4c0022a9e573c0aab58ab8bd47bfc81
|
|
BLAKE2b-256 checksum How to use checksums |
22d621b17f1dfe215b176c2168ed17bdc66581a935f1fb7e253885f78ff3eae1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.18
|
Security for duffel-api 0.6.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.