duffel-api


Nameduffel-api JSON
Version 0.6.2 PyPI version JSON
download
home_pagehttps://github.com/duffelhq/duffel-api-python
SummaryClient library for the Duffel API
upload_time2023-10-02 16:44:41
maintainer
docs_urlNone
authorDuffel Engineering
requires_python>=3.8
licenseMIT
keywords duffel api flights airports airlines aircraft
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage
            [![PyPI](https://img.shields.io/pypi/v/duffel-api?style=flat-square)](https://pypi.org/project/duffel-api/)
[![Supported Python
versions](https://img.shields.io/pypi/pyversions/duffel-api.svg)](https://pypi.org/project/duffel-api/)
[![Build Status](https://github.com/duffelhq/duffel-api-python/actions/workflows/main.yaml/badge.svg)](https://github.com/duffelhq/duffel-api-python/actions/workflows/main.yaml)
[![Code style:black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
[![Downloads](https://pepy.tech/badge/duffel-api/month)](https://pepy.tech/project/duffel-api/month)

# duffel-api

Python client library for the [Duffel API](https://duffel.com/docs/api).

## Requirements

- Python 3.8+

## Getting started

```shell
pip install duffel-api
```

## Usage

You first need to set the API token you can find in the Duffel [dashboard](https://app.duffel.com) under the section
Developers > Access Tokens.

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

```python
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:

```python
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](./examples/book-flight.py).

## Development

### Testing

Run all the tests:

```bash
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`):

```bash
open ./htmlcov/index.html
```

### Packaging

Setup pypi config (`~/.pypirc`):
```text
[pypi]
  username = __token__
  password = pypi-generated-token

[testpypi]
  username = __token__
  password = pypi-generated-token
```

Install dependencies:
```bash
pip install wheel twine
```

Build the package before uploading:

```bash
python setup.py sdist bdist_wheel
```

Upload packages (test):

```bash
twine upload -r testpypi --verbose dist/*
```

The above will upload the packages to [test.pypi.org](https://test.pypi.org) which will allow you to verify all is well
with your upload before uploading it to the main pypi repository.

```bash
twine upload -r pypi --verbose dist/*
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/duffelhq/duffel-api-python",
    "name": "duffel-api",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "",
    "keywords": "duffel api flights airports airlines aircraft",
    "author": "Duffel Engineering",
    "author_email": "client-libraries@duffel.com",
    "download_url": "https://files.pythonhosted.org/packages/16/9b/d57c89203ad7c3de80fad45a9d0c6f86f6206adf4956b74bbbf49bb4c358/duffel-api-0.6.2.tar.gz",
    "platform": null,
    "description": "[![PyPI](https://img.shields.io/pypi/v/duffel-api?style=flat-square)](https://pypi.org/project/duffel-api/)\n[![Supported Python\nversions](https://img.shields.io/pypi/pyversions/duffel-api.svg)](https://pypi.org/project/duffel-api/)\n[![Build Status](https://github.com/duffelhq/duffel-api-python/actions/workflows/main.yaml/badge.svg)](https://github.com/duffelhq/duffel-api-python/actions/workflows/main.yaml)\n[![Code style:black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\n[![Downloads](https://pepy.tech/badge/duffel-api/month)](https://pepy.tech/project/duffel-api/month)\n\n# duffel-api\n\nPython client library for the [Duffel API](https://duffel.com/docs/api).\n\n## Requirements\n\n- Python 3.8+\n\n## Getting started\n\n```shell\npip install duffel-api\n```\n\n## Usage\n\nYou first need to set the API token you can find in the Duffel [dashboard](https://app.duffel.com) under the section\nDevelopers > Access Tokens.\n\nOnce you have the token, you can call `Duffel()` with the value:\n\n```python\nfrom duffel_api import Duffel\n\naccess_token = 'test_...'\nclient = Duffel(access_token = access_token)\n```\n\nAfter you have a client you can interact with, you can make calls to the Duffel API:\n\n```python\nfrom duffel_api import Duffel\n\nclient = Duffel(access_token = 'test...')\n\noffer_requests = client.offer_requests.list()\nfor offer_request in offer_requests:\n    print(offer_request.id)\n```\n\nYou can find a complete example of booking a flight in [./examples/book-flight.py](./examples/book-flight.py).\n\n## Development\n\n### Testing\n\nRun all the tests:\n\n```bash\ntox\n```\n\nAs part of running `tox`, a code coverage report is built for you. You can navigate it by opening `htmlcov/index.html`\nin a browser, or if in a OS that supports it by using `open` (alternative `xdg-open`):\n\n```bash\nopen ./htmlcov/index.html\n```\n\n### Packaging\n\nSetup pypi config (`~/.pypirc`):\n```text\n[pypi]\n  username = __token__\n  password = pypi-generated-token\n\n[testpypi]\n  username = __token__\n  password = pypi-generated-token\n```\n\nInstall dependencies:\n```bash\npip install wheel twine\n```\n\nBuild the package before uploading:\n\n```bash\npython setup.py sdist bdist_wheel\n```\n\nUpload packages (test):\n\n```bash\ntwine upload -r testpypi --verbose dist/*\n```\n\nThe above will upload the packages to [test.pypi.org](https://test.pypi.org) which will allow you to verify all is well\nwith your upload before uploading it to the main pypi repository.\n\n```bash\ntwine upload -r pypi --verbose dist/*\n```\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Client library for the Duffel API",
    "version": "0.6.2",
    "project_urls": {
        "Homepage": "https://github.com/duffelhq/duffel-api-python"
    },
    "split_keywords": [
        "duffel",
        "api",
        "flights",
        "airports",
        "airlines",
        "aircraft"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "22d621b17f1dfe215b176c2168ed17bdc66581a935f1fb7e253885f78ff3eae1",
                "md5": "4c7e3226109c813c9664b43d01693cf3",
                "sha256": "c60f09d0d76c7ee872060ff6722b146bc4c0022a9e573c0aab58ab8bd47bfc81"
            },
            "downloads": -1,
            "filename": "duffel_api-0.6.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "4c7e3226109c813c9664b43d01693cf3",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 68530,
            "upload_time": "2023-10-02T16:44:39",
            "upload_time_iso_8601": "2023-10-02T16:44:39.281725Z",
            "url": "https://files.pythonhosted.org/packages/22/d6/21b17f1dfe215b176c2168ed17bdc66581a935f1fb7e253885f78ff3eae1/duffel_api-0.6.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "169bd57c89203ad7c3de80fad45a9d0c6f86f6206adf4956b74bbbf49bb4c358",
                "md5": "be2951357a0f754a3fa1fc91ce6eeda9",
                "sha256": "663aa5fd55379a75146a9dc86bc5144ea2895c37a9898edc4df3a0e65360ad53"
            },
            "downloads": -1,
            "filename": "duffel-api-0.6.2.tar.gz",
            "has_sig": false,
            "md5_digest": "be2951357a0f754a3fa1fc91ce6eeda9",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 38434,
            "upload_time": "2023-10-02T16:44:41",
            "upload_time_iso_8601": "2023-10-02T16:44:41.133189Z",
            "url": "https://files.pythonhosted.org/packages/16/9b/d57c89203ad7c3de80fad45a9d0c6f86f6206adf4956b74bbbf49bb4c358/duffel-api-0.6.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-10-02 16:44:41",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "duffelhq",
    "github_project": "duffel-api-python",
    "travis_ci": false,
    "coveralls": true,
    "github_actions": true,
    "tox": true,
    "lcname": "duffel-api"
}
        
Elapsed time: 0.15598s