Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

For #265: Async Client #268

Merged
merged 7 commits into from
Nov 11, 2021
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ kinto_http.egg-info/
.venv/
.tox
.pytest_cache/
.vscode/
4 changes: 3 additions & 1 deletion CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ This document describes changes between each past release.
10.8.0 (unreleased)
===================

- Nothing changed yet.
**New features**

- Asynchronous client is now available: ``from kinto_http import AsyncClient`` (`#268 <https://github.com/Kinto/kinto-http.py/pull/268>`_)


10.7.0 (2020-01-09)
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ git remote add {your_name} git@github.com:{your_name}/kinto-http.py.git
## Testing

- `make tests-once` to run the tests with the current venv.
- `make tests` to run all the tests (with Py2 and Py3, flake8 and functional tests)
- `make tests` to run all the tests (with python3, flake8, and functional tests)

You may need to use `make runkinto` before running the functional tests.
If you want to run the functional tests only, you can use `make functional`.
Expand Down
12 changes: 6 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
VIRTUALENV = virtualenv --python=python3.7
VIRTUALENV = virtualenv --python=python3
VENV := $(shell echo $${VIRTUAL_ENV-.venv})
PYTHON = $(VENV)/bin/python
DEV_STAMP = $(VENV)/.dev_env_installed.stamp
Expand All @@ -19,7 +19,7 @@ $(INSTALL_STAMP): $(PYTHON) setup.py

install-dev: $(INSTALL_STAMP) $(DEV_STAMP)
$(DEV_STAMP): $(PYTHON) dev-requirements.txt
$(VENV)/bin/pip install --pre -Ur dev-requirements.txt
$(VENV)/bin/pip install -Ur dev-requirements.txt
touch $(DEV_STAMP)

virtualenv: $(PYTHON)
Expand All @@ -34,13 +34,13 @@ runkinto: install-dev
$(VENV)/bin/kinto start --ini kinto_http/tests/config/kinto.ini

tests-once: install-dev need-kinto-running
$(VENV)/bin/py.test kinto_http/tests/functional.py kinto_http/tests --cov-report term-missing --cov-fail-under 100 --cov kinto_http
$(VENV)/bin/pytest --cov-report term-missing --cov-fail-under 100 --cov kinto_http

functional: install-dev need-kinto-running
$(VENV)/bin/py.test kinto_http/tests/functional.py
$(VENV)/bin/pytest -k "test_functional"

tests: install-dev need-kinto-running
$(VENV)/bin/py.test -f kinto_http/tests/ kinto_http/tests/functional.py
tests: install-dev need-kinto-running lint
$(VENV)/bin/pytest

format: install-dev
$(VENV)/bin/isort --profile=black --lines-after-imports=2 kinto_http
Expand Down
13 changes: 12 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,17 @@ some key arguments.

client2 = client.clone(collection="orders")

An asynchronous client is also available. It has all the same endpoints as the sync client except for the batch operations.

.. code-block:: python

from kinto_http import AsyncClient

auth = ('alexis', 'p4ssw0rd')

client = AsyncClient(server_url='http://localhost:8888/v1', auth=auth)
info = await client.server_info()
assert 'schema' in info['capabilities'], "Server doesn't support schema validation."

Using a Bearer access token to authenticate (OpenID)
----------------------------------------------------
Expand Down Expand Up @@ -236,7 +247,7 @@ Batching operations
-------------------

Rather than issuing a request for each and every operation, it is possible to
batch several operations in one request.
batch several operations in one request (sync client only).

Using the ``batch()`` method as a Python context manager (``with``):

Expand Down
4 changes: 3 additions & 1 deletion dev-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
black
flake8
isort
kinto
pytest
pytest-asyncio
pytest-cache
pytest-cov
pytest-mock
pytest-xdist
kinto
therapist
unidecode
Loading