Skip to main content
https://img.shields.io/travis/sjaensch/bravado-asyncio.svg https://coveralls.io/repos/github/sjaensch/bravado-asyncio/badge.svg?branch=master PyPi version Supported Python versions

bravado-asyncio

Note: This is not a fork or reimplementation of bravado using asynchronous programming (like aiomysql is for PyMySQL). The interface of bravado remains unchanged. If you’re developing fully asynchronous applications, you should use aiobravado instead.

bravado-asyncio is an asynchronous HTTP client for the bravado library. It uses Python’s asyncio and aiohttp internally. It enables you to do concurrent network requests with bravado, similar to the fido client. Unlike fido, bravado-asyncio does not depend on crochet or twisted and uses Python 3’s standard library to implement asynchronous behavior.

aiobravado, the fully asynchronous version of bravado, uses bravado-asyncio internally as HTTP client.

Example usage

If you’re familiar with bravado then all you need to do is switch out (or specify) your HTTP client:

from bravado_asyncio.http_client import AsyncioClient
from bravado.client import SwaggerClient

client = SwaggerClient.from_url(
    'http://petstore.swagger.io/v2/swagger.json',
    http_client=AsyncioClient(),
)
pet = client.pet.getPetById(petId=42).result()

Installation

# This will install bravado-asyncio and bravado
$ pip install bravado-asyncio

# To install bravado-asyncio with the optional cchardet and aiodns packages,
# which are recommended by the underlying aiohttp package
$ pip install bravado-asyncio[aiohttp_extras]

Project status

The project is successfully used in production at Yelp. We have an integration test suite that not only covers bravado-asyncio behavior, but also makes sure that behavior is equal to the (default) synchronous bravado HTTP client. That said, if you find a bug please file an issue!

Development and contributing

Developing bravado-asyncio requires a working installation of Python 3.6 with the virtualenv package being installed. All other requirements will be installed in a virtualenv created in the venv directory. We also expect make to be installed. If you do not have it and do not want to install it then please refer to the Makefile as to what commands need to be run for each target.

  1. Run make. This will create the virtualenv you will use for development, with all runtime and development dependencies installed.

  2. If you’re using aactivator then you will be prompted to activate the new environment, please do so. If you prefer not to use aactivator, do source .activate.sh.

  3. Make sure everything is set up correctly by running make test.

Since make test will run tests with multiple Python versions, you’ll get an error if one of them can’t be found. You can ask tox to run tests with a specific Python version like so:

$ tox -e py38

This will run tests with Python 3.8.

We do run linters that currently require Python 3.6. You can run them with tox -e pre-commit.

Travis (the continuous integration system) and Github Actions will run tests with all supported Python versions, on all supported platforms (Linux, macOS, Windows). Make sure you don’t write code that works only on certain platforms or Python versions.

Great, you’re ready to go! If you have an improvement or bugfix, please submit a pull request.

The event loop

bravado-asyncio creates its own event loop in a separate thread. This is necessary as it is not possible to use the main event loop - it would require a fork of bravado, making its public interface asynchronous. That said, bravado-asyncio and bravado should work well with your existing asyncio application.

You shouldn’t normally need to interact with bravado-asyncio’s event loop. If you do need to do so please use bravado_asyncio.http_client.get_loop() to retrieve it. Note that it won’t be the currently active loop!

License

Written by Stephan Jaensch and licensed under the BSD 3-clause license (see LICENSE.txt).

Metadata

Release files for bravado-asyncio 2.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for bravado-asyncio 2.0.2
File Size Uploaded
bravado-asyncio-2.0.2.tar.gz 11.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for bravado-asyncio 2.0.2
File Interpreter ABI Platform
bravado_asyncio-2.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 21.2 kB

Release files / bravado-asyncio-2.0.2.tar.gz

Download URL bravado-asyncio-2.0.2.tar.gz
Size 11.1 kB
Tags Source
SHA-256 checksum
How to use checksums
1767d6757901b05079cb7b5a73d236df99bcf99d8242a772d39cd862e996d827
BLAKE2b-256 checksum
How to use checksums
6ae2cdc661aad3b4ef3dd87216b13ad22538f2ae1e14ad39b691e73596c70e68
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.8.3

Release files / bravado_asyncio-2.0.2-py3-none-any.whl

Download URL bravado_asyncio-2.0.2-py3-none-any.whl
Size 10.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
58ef61ada41a92f3648bda8cf370011db0b477aae9815a0ba4e2beeebc28feaf
BLAKE2b-256 checksum
How to use checksums
da01463d110c5295367f9606bdcbbfe9f100cbe444f3805c06a1f04a47c668df
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.8.3

Release history Release notifications | RSS feed

This release

2.0.2 This release

2 release files

2.0.1

2 release files

2.0.0

2 release files

1.5.0

2 release files

1.4.2

2 release files

1.4.1

2 release files

1.4.0

2 release files

1.3.0

2 release files

1.2.0

2 release files

1.1.0

2 release files

1.0.0

2 release files

0.4.3

2 release files

0.4.2

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.4

2 release files

0.3.3

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.0

1 release file

0.1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page