diff options
author | CoprDistGit <infra@openeuler.org> | 2023-05-05 05:57:43 +0000 |
---|---|---|
committer | CoprDistGit <infra@openeuler.org> | 2023-05-05 05:57:43 +0000 |
commit | 44225b887a439e7ee1782c0a2d55fcf31dfb27ca (patch) | |
tree | 6b9cb820b1f06313a9d2acaf01638d9088455e84 | |
parent | fd65e14a116c85b4895be7d2088a477ba47f12eb (diff) |
automatic import of python-aio-requestopeneuler20.03
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | python-aio-request.spec | 719 | ||||
-rw-r--r-- | sources | 1 |
3 files changed, 721 insertions, 0 deletions
@@ -0,0 +1 @@ +/aio-request-0.1.29.tar.gz diff --git a/python-aio-request.spec b/python-aio-request.spec new file mode 100644 index 0000000..20fde31 --- /dev/null +++ b/python-aio-request.spec @@ -0,0 +1,719 @@ +%global _empty_manifest_terminate_build 0 +Name: python-aio-request +Version: 0.1.29 +Release: 1 +Summary: Various strategies for sending requests +License: MIT +URL: https://github.com/Pliner/aio-request +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/c7/42/84787dce68ff21f87228236e51f7c687fcd93aeef24041b38a1986a9477d/aio-request-0.1.29.tar.gz +BuildArch: noarch + +Requires: python3-multidict +Requires: python3-yarl + +%description +# aio-request + +This library simplifies an interaction between microservices: +1. Allows sending requests using various strategies +1. Propagates a deadline and a priority of requests +1. Exposes client/server metrics + +Example: +```python +import aiohttp +import aio_request + +async with aiohttp.ClientSession() as client_session: + client = aio_request.setup( + transport=aio_request.AioHttpTransport(client_session), + endpoint="http://endpoint:8080/", + ) + response_ctx = client.request( + aio_request.get("thing"), + deadline=aio_request.Deadline.from_timeout(5) + ) + async with response_ctx as response: + pass # process response here +``` + +# Request strategies +The following strategies are supported: +1. Single attempt. Only one attempt is sent. +1. Sequential. Attempts are sent sequentially with delays between them. +1. Parallel. Attempts are sent in parallel one by one with delays between them. + +Attempts count and delays are configurable. + +Example: +```python +import aiohttp +import aio_request + +async with aiohttp.ClientSession() as client_session: + client = aio_request.setup( + transport=aio_request.AioHttpTransport(client_session), + endpoint="http://endpoint:8080/", + ) + response_ctx = client.request( + aio_request.get("thing"), + deadline=aio_request.Deadline.from_timeout(5), + strategy=aio_request.parallel_strategy( + attempts_count=3, + delays_provider=aio_request.linear_delays(min_delay_seconds=0.1, delay_multiplier=0.1) + ) + ) + async with response_ctx as response: + pass # process response here +``` + +# Deadline & priority propagation + +To enable it for the server side a middleware should be configured: +```python +import aiohttp.web +import aio_request + +app = aiohttp.web.Application(middlewares=[aio_request.aiohttp_middleware_factory()]) +``` + +# Expose client/server metrics + +To enable client metrics a metrics provider should be passed to the transport: +```python +import aiohttp +import aio_request + +async with aiohttp.ClientSession() as client_session: + client = aio_request.setup( + transport=aio_request.AioHttpTransport( + client_session, + metrics_provider=aio_request.PROMETHEUS_METRICS_PROVIDER + ), + endpoint="http://endpoint:8080/", + ) +``` + +It is an example of how it should be done for aiohttp and prometheus. + +To enable client metrics a metrics provider should be passed to the middleware: +```python +import aiohttp.web +import aio_request + +app = aiohttp.web.Application( + middlewares=[ + aio_request.aiohttp_middleware_factory( + metrics_provider=aio_request.PROMETHEUS_METRICS_PROVIDER + ) + ] +) +``` + +# Circuit breaker + +```python +import aiohttp +import aio_request + +async with aiohttp.ClientSession() as client_session: + client = aio_request.setup_v2( + transport=aio_request.AioHttpTransport(client_session), + endpoint="http://endpoint:8080/", + circuit_breaker=aio_request.DefaultCircuitBreaker[str, int]( + break_duration=1.0, + sampling_duration=1.0, + minimum_throughput=2, + failure_threshold=0.5, + ), + ) +``` + +In the case of requests count >= minimum throughput(>=2) in sampling period(1 second) the circuit breaker will open +if failed requests count/total requests count >= failure threshold(50%). + +## v0.1.29 (2023-04-27) + +* [Stop losing redirects params in headers update](https://github.com/anna-money/aio-request/pull/204) + + +## v0.1.28 (2023-04-27) + +* [Add allow_redirects and max_redirects options to request](https://github.com/anna-money/aio-request/pull/195) + + +## v0.1.27 (2023-02-16) + +* [Maintenance release](https://github.com/anna-money/aio-request/compare/v0.1.26...v0.1.27) + + +## v0.1.26 (2022-11-02) + +* [Add python 3.11 support](https://github.com/anna-money/aio-request/pull/159) + + +## v0.1.25 (2022-08-25) + +* [Reverted: URL-encode path_parameters](https://github.com/anna-money/aio-request/pull/155) - let user + decide what to do + + +## v0.1.24 (2022-07-04) + +* [URL-encode path_parameters](https://github.com/anna-money/aio-request/pull/146) + + +## v0.1.23 (2022-02-08) + +* [Reject throttling(too many requests) status code](https://github.com/anna-money/aio-request/pull/123) + + +## v0.1.22 (2022-01-08) + +* Return default json expected content_type to "application/json" +* [Release aiohttp response instead of close](https://github.com/Pliner/aio-request/pull/108) +* [Validate json content-type](https://github.com/Pliner/aio-request/pull/109) + + +## v0.1.21 (2022-01-05) + +* Content type should be None in Response.json() + + +## v0.1.20 (2022-01-05) + +* [Do not expect json content type by default](https://github.com/Pliner/aio-request/pull/106) + + +## v0.1.19 (2021-11-01) + +* [Support async-timeout 4.0+](https://github.com/Pliner/aio-request/pull/86) + + +## v0.1.18 (2021-09-08) + +* [Reexport explicitly](https://github.com/Pliner/aio-request/pull/74) + +## v0.1.17 (2021-09-01) + +* [Fix patch/patch_json visibility](https://github.com/Pliner/aio-request/pull/73) + +## v0.1.16 (2021-09-01) + +* [Support patch method](https://github.com/Pliner/aio-request/pull/72) + +## v0.1.15 (2021-09-01) + +* [Clean up resources in single shield](https://github.com/Pliner/aio-request/pull/71) + +## v0.1.14 (2021-08-18) + +* [Keys should be materialized if dict is changed in loop](https://github.com/Pliner/aio-request/pull/66) + +## v0.1.13 (2021-08-15) + +* [Circuit breaker](https://github.com/Pliner/aio-request/pull/65) + +## v0.1.12 (2021-07-21) + +* [Basic repr implementation](https://github.com/Pliner/aio-request/commit/adaa4888c3d372fa65f3dd5eb6113ab68f46de24) + +## v0.1.11 (2021-07-21) + +* Fix Request.update_headers, add Request.extend_headers [#59](https://github.com/Pliner/aio-request/pull/59) + +## v0.1.10 (2021-07-20) + +* Add Response.is_json property to check whether content-type is json compatible [#58](https://github.com/Pliner/aio-request/pull/58) +* Tracing support [#54](https://github.com/Pliner/aio-request/pull/54), +* [Configuration](https://github.com/Pliner/aio-request/commit/f0e1904f4d87daf7c242a834168c0f1b25dd86d5) of a new pipeline + + +%package -n python3-aio-request +Summary: Various strategies for sending requests +Provides: python-aio-request +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-aio-request +# aio-request + +This library simplifies an interaction between microservices: +1. Allows sending requests using various strategies +1. Propagates a deadline and a priority of requests +1. Exposes client/server metrics + +Example: +```python +import aiohttp +import aio_request + +async with aiohttp.ClientSession() as client_session: + client = aio_request.setup( + transport=aio_request.AioHttpTransport(client_session), + endpoint="http://endpoint:8080/", + ) + response_ctx = client.request( + aio_request.get("thing"), + deadline=aio_request.Deadline.from_timeout(5) + ) + async with response_ctx as response: + pass # process response here +``` + +# Request strategies +The following strategies are supported: +1. Single attempt. Only one attempt is sent. +1. Sequential. Attempts are sent sequentially with delays between them. +1. Parallel. Attempts are sent in parallel one by one with delays between them. + +Attempts count and delays are configurable. + +Example: +```python +import aiohttp +import aio_request + +async with aiohttp.ClientSession() as client_session: + client = aio_request.setup( + transport=aio_request.AioHttpTransport(client_session), + endpoint="http://endpoint:8080/", + ) + response_ctx = client.request( + aio_request.get("thing"), + deadline=aio_request.Deadline.from_timeout(5), + strategy=aio_request.parallel_strategy( + attempts_count=3, + delays_provider=aio_request.linear_delays(min_delay_seconds=0.1, delay_multiplier=0.1) + ) + ) + async with response_ctx as response: + pass # process response here +``` + +# Deadline & priority propagation + +To enable it for the server side a middleware should be configured: +```python +import aiohttp.web +import aio_request + +app = aiohttp.web.Application(middlewares=[aio_request.aiohttp_middleware_factory()]) +``` + +# Expose client/server metrics + +To enable client metrics a metrics provider should be passed to the transport: +```python +import aiohttp +import aio_request + +async with aiohttp.ClientSession() as client_session: + client = aio_request.setup( + transport=aio_request.AioHttpTransport( + client_session, + metrics_provider=aio_request.PROMETHEUS_METRICS_PROVIDER + ), + endpoint="http://endpoint:8080/", + ) +``` + +It is an example of how it should be done for aiohttp and prometheus. + +To enable client metrics a metrics provider should be passed to the middleware: +```python +import aiohttp.web +import aio_request + +app = aiohttp.web.Application( + middlewares=[ + aio_request.aiohttp_middleware_factory( + metrics_provider=aio_request.PROMETHEUS_METRICS_PROVIDER + ) + ] +) +``` + +# Circuit breaker + +```python +import aiohttp +import aio_request + +async with aiohttp.ClientSession() as client_session: + client = aio_request.setup_v2( + transport=aio_request.AioHttpTransport(client_session), + endpoint="http://endpoint:8080/", + circuit_breaker=aio_request.DefaultCircuitBreaker[str, int]( + break_duration=1.0, + sampling_duration=1.0, + minimum_throughput=2, + failure_threshold=0.5, + ), + ) +``` + +In the case of requests count >= minimum throughput(>=2) in sampling period(1 second) the circuit breaker will open +if failed requests count/total requests count >= failure threshold(50%). + +## v0.1.29 (2023-04-27) + +* [Stop losing redirects params in headers update](https://github.com/anna-money/aio-request/pull/204) + + +## v0.1.28 (2023-04-27) + +* [Add allow_redirects and max_redirects options to request](https://github.com/anna-money/aio-request/pull/195) + + +## v0.1.27 (2023-02-16) + +* [Maintenance release](https://github.com/anna-money/aio-request/compare/v0.1.26...v0.1.27) + + +## v0.1.26 (2022-11-02) + +* [Add python 3.11 support](https://github.com/anna-money/aio-request/pull/159) + + +## v0.1.25 (2022-08-25) + +* [Reverted: URL-encode path_parameters](https://github.com/anna-money/aio-request/pull/155) - let user + decide what to do + + +## v0.1.24 (2022-07-04) + +* [URL-encode path_parameters](https://github.com/anna-money/aio-request/pull/146) + + +## v0.1.23 (2022-02-08) + +* [Reject throttling(too many requests) status code](https://github.com/anna-money/aio-request/pull/123) + + +## v0.1.22 (2022-01-08) + +* Return default json expected content_type to "application/json" +* [Release aiohttp response instead of close](https://github.com/Pliner/aio-request/pull/108) +* [Validate json content-type](https://github.com/Pliner/aio-request/pull/109) + + +## v0.1.21 (2022-01-05) + +* Content type should be None in Response.json() + + +## v0.1.20 (2022-01-05) + +* [Do not expect json content type by default](https://github.com/Pliner/aio-request/pull/106) + + +## v0.1.19 (2021-11-01) + +* [Support async-timeout 4.0+](https://github.com/Pliner/aio-request/pull/86) + + +## v0.1.18 (2021-09-08) + +* [Reexport explicitly](https://github.com/Pliner/aio-request/pull/74) + +## v0.1.17 (2021-09-01) + +* [Fix patch/patch_json visibility](https://github.com/Pliner/aio-request/pull/73) + +## v0.1.16 (2021-09-01) + +* [Support patch method](https://github.com/Pliner/aio-request/pull/72) + +## v0.1.15 (2021-09-01) + +* [Clean up resources in single shield](https://github.com/Pliner/aio-request/pull/71) + +## v0.1.14 (2021-08-18) + +* [Keys should be materialized if dict is changed in loop](https://github.com/Pliner/aio-request/pull/66) + +## v0.1.13 (2021-08-15) + +* [Circuit breaker](https://github.com/Pliner/aio-request/pull/65) + +## v0.1.12 (2021-07-21) + +* [Basic repr implementation](https://github.com/Pliner/aio-request/commit/adaa4888c3d372fa65f3dd5eb6113ab68f46de24) + +## v0.1.11 (2021-07-21) + +* Fix Request.update_headers, add Request.extend_headers [#59](https://github.com/Pliner/aio-request/pull/59) + +## v0.1.10 (2021-07-20) + +* Add Response.is_json property to check whether content-type is json compatible [#58](https://github.com/Pliner/aio-request/pull/58) +* Tracing support [#54](https://github.com/Pliner/aio-request/pull/54), +* [Configuration](https://github.com/Pliner/aio-request/commit/f0e1904f4d87daf7c242a834168c0f1b25dd86d5) of a new pipeline + + +%package help +Summary: Development documents and examples for aio-request +Provides: python3-aio-request-doc +%description help +# aio-request + +This library simplifies an interaction between microservices: +1. Allows sending requests using various strategies +1. Propagates a deadline and a priority of requests +1. Exposes client/server metrics + +Example: +```python +import aiohttp +import aio_request + +async with aiohttp.ClientSession() as client_session: + client = aio_request.setup( + transport=aio_request.AioHttpTransport(client_session), + endpoint="http://endpoint:8080/", + ) + response_ctx = client.request( + aio_request.get("thing"), + deadline=aio_request.Deadline.from_timeout(5) + ) + async with response_ctx as response: + pass # process response here +``` + +# Request strategies +The following strategies are supported: +1. Single attempt. Only one attempt is sent. +1. Sequential. Attempts are sent sequentially with delays between them. +1. Parallel. Attempts are sent in parallel one by one with delays between them. + +Attempts count and delays are configurable. + +Example: +```python +import aiohttp +import aio_request + +async with aiohttp.ClientSession() as client_session: + client = aio_request.setup( + transport=aio_request.AioHttpTransport(client_session), + endpoint="http://endpoint:8080/", + ) + response_ctx = client.request( + aio_request.get("thing"), + deadline=aio_request.Deadline.from_timeout(5), + strategy=aio_request.parallel_strategy( + attempts_count=3, + delays_provider=aio_request.linear_delays(min_delay_seconds=0.1, delay_multiplier=0.1) + ) + ) + async with response_ctx as response: + pass # process response here +``` + +# Deadline & priority propagation + +To enable it for the server side a middleware should be configured: +```python +import aiohttp.web +import aio_request + +app = aiohttp.web.Application(middlewares=[aio_request.aiohttp_middleware_factory()]) +``` + +# Expose client/server metrics + +To enable client metrics a metrics provider should be passed to the transport: +```python +import aiohttp +import aio_request + +async with aiohttp.ClientSession() as client_session: + client = aio_request.setup( + transport=aio_request.AioHttpTransport( + client_session, + metrics_provider=aio_request.PROMETHEUS_METRICS_PROVIDER + ), + endpoint="http://endpoint:8080/", + ) +``` + +It is an example of how it should be done for aiohttp and prometheus. + +To enable client metrics a metrics provider should be passed to the middleware: +```python +import aiohttp.web +import aio_request + +app = aiohttp.web.Application( + middlewares=[ + aio_request.aiohttp_middleware_factory( + metrics_provider=aio_request.PROMETHEUS_METRICS_PROVIDER + ) + ] +) +``` + +# Circuit breaker + +```python +import aiohttp +import aio_request + +async with aiohttp.ClientSession() as client_session: + client = aio_request.setup_v2( + transport=aio_request.AioHttpTransport(client_session), + endpoint="http://endpoint:8080/", + circuit_breaker=aio_request.DefaultCircuitBreaker[str, int]( + break_duration=1.0, + sampling_duration=1.0, + minimum_throughput=2, + failure_threshold=0.5, + ), + ) +``` + +In the case of requests count >= minimum throughput(>=2) in sampling period(1 second) the circuit breaker will open +if failed requests count/total requests count >= failure threshold(50%). + +## v0.1.29 (2023-04-27) + +* [Stop losing redirects params in headers update](https://github.com/anna-money/aio-request/pull/204) + + +## v0.1.28 (2023-04-27) + +* [Add allow_redirects and max_redirects options to request](https://github.com/anna-money/aio-request/pull/195) + + +## v0.1.27 (2023-02-16) + +* [Maintenance release](https://github.com/anna-money/aio-request/compare/v0.1.26...v0.1.27) + + +## v0.1.26 (2022-11-02) + +* [Add python 3.11 support](https://github.com/anna-money/aio-request/pull/159) + + +## v0.1.25 (2022-08-25) + +* [Reverted: URL-encode path_parameters](https://github.com/anna-money/aio-request/pull/155) - let user + decide what to do + + +## v0.1.24 (2022-07-04) + +* [URL-encode path_parameters](https://github.com/anna-money/aio-request/pull/146) + + +## v0.1.23 (2022-02-08) + +* [Reject throttling(too many requests) status code](https://github.com/anna-money/aio-request/pull/123) + + +## v0.1.22 (2022-01-08) + +* Return default json expected content_type to "application/json" +* [Release aiohttp response instead of close](https://github.com/Pliner/aio-request/pull/108) +* [Validate json content-type](https://github.com/Pliner/aio-request/pull/109) + + +## v0.1.21 (2022-01-05) + +* Content type should be None in Response.json() + + +## v0.1.20 (2022-01-05) + +* [Do not expect json content type by default](https://github.com/Pliner/aio-request/pull/106) + + +## v0.1.19 (2021-11-01) + +* [Support async-timeout 4.0+](https://github.com/Pliner/aio-request/pull/86) + + +## v0.1.18 (2021-09-08) + +* [Reexport explicitly](https://github.com/Pliner/aio-request/pull/74) + +## v0.1.17 (2021-09-01) + +* [Fix patch/patch_json visibility](https://github.com/Pliner/aio-request/pull/73) + +## v0.1.16 (2021-09-01) + +* [Support patch method](https://github.com/Pliner/aio-request/pull/72) + +## v0.1.15 (2021-09-01) + +* [Clean up resources in single shield](https://github.com/Pliner/aio-request/pull/71) + +## v0.1.14 (2021-08-18) + +* [Keys should be materialized if dict is changed in loop](https://github.com/Pliner/aio-request/pull/66) + +## v0.1.13 (2021-08-15) + +* [Circuit breaker](https://github.com/Pliner/aio-request/pull/65) + +## v0.1.12 (2021-07-21) + +* [Basic repr implementation](https://github.com/Pliner/aio-request/commit/adaa4888c3d372fa65f3dd5eb6113ab68f46de24) + +## v0.1.11 (2021-07-21) + +* Fix Request.update_headers, add Request.extend_headers [#59](https://github.com/Pliner/aio-request/pull/59) + +## v0.1.10 (2021-07-20) + +* Add Response.is_json property to check whether content-type is json compatible [#58](https://github.com/Pliner/aio-request/pull/58) +* Tracing support [#54](https://github.com/Pliner/aio-request/pull/54), +* [Configuration](https://github.com/Pliner/aio-request/commit/f0e1904f4d87daf7c242a834168c0f1b25dd86d5) of a new pipeline + + +%prep +%autosetup -n aio-request-0.1.29 + +%build +%py3_build + +%install +%py3_install +install -d -m755 %{buildroot}/%{_pkgdocdir} +if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi +if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi +if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi +if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi +pushd %{buildroot} +if [ -d usr/lib ]; then + find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/lib64 ]; then + find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/bin ]; then + find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/sbin ]; then + find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst +fi +touch doclist.lst +if [ -d usr/share/man ]; then + find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst +fi +popd +mv %{buildroot}/filelist.lst . +mv %{buildroot}/doclist.lst . + +%files -n python3-aio-request -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Fri May 05 2023 Python_Bot <Python_Bot@openeuler.org> - 0.1.29-1 +- Package Spec generated @@ -0,0 +1 @@ +f666572db97fddfecc0dc9e2bf531993 aio-request-0.1.29.tar.gz |