diff options
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | python-aiohttp-client-cache.spec | 359 | ||||
-rw-r--r-- | sources | 1 |
3 files changed, 361 insertions, 0 deletions
@@ -0,0 +1 @@ +/aiohttp_client_cache-0.8.1.tar.gz diff --git a/python-aiohttp-client-cache.spec b/python-aiohttp-client-cache.spec new file mode 100644 index 0000000..e09959f --- /dev/null +++ b/python-aiohttp-client-cache.spec @@ -0,0 +1,359 @@ +%global _empty_manifest_terminate_build 0 +Name: python-aiohttp-client-cache +Version: 0.8.1 +Release: 1 +Summary: Persistent cache for aiohttp requests +License: MIT +URL: https://github.com/requests-cache/aiohttp-client-cache +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/12/3a/3be445b1c587b61f85a680e2a1b4ba20b35e8f003dfc50b66fd61d7fcffa/aiohttp_client_cache-0.8.1.tar.gz +BuildArch: noarch + +Requires: python3-aiohttp +Requires: python3-attrs +Requires: python3-itsdangerous +Requires: python3-forge +Requires: python3-url-normalize +Requires: python3-aioboto3 +Requires: python3-aiobotocore +Requires: python3-aiofiles +Requires: python3-aiosqlite +Requires: python3-motor +Requires: python3-redis +Requires: python3-furo +Requires: python3-linkify-it-py +Requires: python3-myst-parser +Requires: python3-sphinx +Requires: python3-sphinx-automodapi +Requires: python3-sphinx-autodoc-typehints +Requires: python3-sphinx-copybutton +Requires: python3-sphinx-inline-tabs +Requires: python3-sphinxcontrib-apidoc + +%description +# aiohttp-client-cache + +[](https://github.com/requests-cache/aiohttp-client-cache/actions) +[](https://aiohttp-client-cache.readthedocs.io/en/latest/) +[](https://codecov.io/gh/requests-cache/aiohttp-client-cache) +[](https://pypi.org/project/aiohttp-client-cache) +[](https://anaconda.org/conda-forge/aiohttp-client-cache) +[](https://pypi.org/project/aiohttp-client-cache) +[](https://pypi.org/project/aiohttp-client-cache) + +**aiohttp-client-cache** is an async persistent cache for [aiohttp](https://docs.aiohttp.org) +client requests, based on [requests-cache](https://github.com/reclosedev/requests-cache). + +# Features +* **Ease of use:** Use as a [drop-in replacement](https://aiohttp-client-cache.readthedocs.io/en/latest/user_guide.html) + for `aiohttp.ClientSession` +* **Customization:** Works out of the box with little to no config, but with plenty of options + available for customizing cache + [expiration](https://aiohttp-client-cache.readthedocs.io/en/latest/user_guide.html#cache-expiration) + and other [behavior](https://aiohttp-client-cache.readthedocs.io/en/latest/user_guide.html#cache-options) +* **Persistence:** Includes several [storage backends](https://aiohttp-client-cache.readthedocs.io/en/latest/backends.html): + SQLite, DynamoDB, MongoDB, and Redis. + +# Development Status +**This library is a work in progress!** + +Breaking changes should be expected until a `1.0` release, so version pinning is recommended. + +My goal for this library is to eventually have a similar (but not identical) feature set as +`requests-cache`, and also contribute new features from this library back to `requests-cache`. +If there is a feature you want, if you've discovered a bug, or if you have other general feedback, please +[create an issue](https://github.com/requests-cache/aiohttp-client-cache/issues/new/choose) for it! + +# Quickstart +First, install with pip (python 3.7+ required): +```bash +pip install aiohttp-client-cache +``` + +## Basic Usage +Next, use [aiohttp_client_cache.CachedSession](https://aiohttp-client-cache.readthedocs.io/en/latest/modules/aiohttp_client_cache.session.html#aiohttp_client_cache.session.CachedSession) +in place of [aiohttp.ClientSession](https://docs.aiohttp.org/en/stable/client_reference.html#aiohttp.ClientSession). +To briefly demonstrate how to use it: + +**Replace this:** +```python +from aiohttp import ClientSession + +async with ClientSession() as session: + await session.get('http://httpbin.org/delay/1') +``` + +**With this:** +```python +from aiohttp_client_cache import CachedSession, SQLiteBackend + +async with CachedSession(cache=SQLiteBackend('demo_cache')) as session: + await session.get('http://httpbin.org/delay/1') +``` + +The URL in this example adds a delay of 1 second, simulating a slow or rate-limited website. +With caching, the response will be fetched once, saved to `demo_cache.sqlite`, and subsequent +requests will return the cached response near-instantly. + +## Configuration +Several options are available to customize caching behavior. This example demonstrates a few of them: + +```python +# fmt: off +from aiohttp_client_cache import SQLiteBackend + +cache = SQLiteBackend( + cache_name='~/.cache/aiohttp-requests.db', # For SQLite, this will be used as the filename + expire_after=60*60, # By default, cached responses expire in an hour + urls_expire_after={'*.fillmurray.com': -1}, # Requests for any subdomain on this site will never expire + allowed_codes=(200, 418), # Cache responses with these status codes + allowed_methods=['GET', 'POST'], # Cache requests with these HTTP methods + include_headers=True, # Cache requests with different headers separately + ignored_params=['auth_token'], # Keep using the cached response even if this param changes + timeout=2.5, # Connection timeout for SQLite backend +) +``` + +# More Info +To learn more, see: +* [User Guide](https://aiohttp-client-cache.readthedocs.io/en/latest/user_guide.html) +* [Cache Backends](https://aiohttp-client-cache.readthedocs.io/en/latest/backends.html) +* [API Reference](https://aiohttp-client-cache.readthedocs.io/en/latest/reference.html) +* [Examples](https://aiohttp-client-cache.readthedocs.io/en/latest/examples.html) + + +%package -n python3-aiohttp-client-cache +Summary: Persistent cache for aiohttp requests +Provides: python-aiohttp-client-cache +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-aiohttp-client-cache +# aiohttp-client-cache + +[](https://github.com/requests-cache/aiohttp-client-cache/actions) +[](https://aiohttp-client-cache.readthedocs.io/en/latest/) +[](https://codecov.io/gh/requests-cache/aiohttp-client-cache) +[](https://pypi.org/project/aiohttp-client-cache) +[](https://anaconda.org/conda-forge/aiohttp-client-cache) +[](https://pypi.org/project/aiohttp-client-cache) +[](https://pypi.org/project/aiohttp-client-cache) + +**aiohttp-client-cache** is an async persistent cache for [aiohttp](https://docs.aiohttp.org) +client requests, based on [requests-cache](https://github.com/reclosedev/requests-cache). + +# Features +* **Ease of use:** Use as a [drop-in replacement](https://aiohttp-client-cache.readthedocs.io/en/latest/user_guide.html) + for `aiohttp.ClientSession` +* **Customization:** Works out of the box with little to no config, but with plenty of options + available for customizing cache + [expiration](https://aiohttp-client-cache.readthedocs.io/en/latest/user_guide.html#cache-expiration) + and other [behavior](https://aiohttp-client-cache.readthedocs.io/en/latest/user_guide.html#cache-options) +* **Persistence:** Includes several [storage backends](https://aiohttp-client-cache.readthedocs.io/en/latest/backends.html): + SQLite, DynamoDB, MongoDB, and Redis. + +# Development Status +**This library is a work in progress!** + +Breaking changes should be expected until a `1.0` release, so version pinning is recommended. + +My goal for this library is to eventually have a similar (but not identical) feature set as +`requests-cache`, and also contribute new features from this library back to `requests-cache`. +If there is a feature you want, if you've discovered a bug, or if you have other general feedback, please +[create an issue](https://github.com/requests-cache/aiohttp-client-cache/issues/new/choose) for it! + +# Quickstart +First, install with pip (python 3.7+ required): +```bash +pip install aiohttp-client-cache +``` + +## Basic Usage +Next, use [aiohttp_client_cache.CachedSession](https://aiohttp-client-cache.readthedocs.io/en/latest/modules/aiohttp_client_cache.session.html#aiohttp_client_cache.session.CachedSession) +in place of [aiohttp.ClientSession](https://docs.aiohttp.org/en/stable/client_reference.html#aiohttp.ClientSession). +To briefly demonstrate how to use it: + +**Replace this:** +```python +from aiohttp import ClientSession + +async with ClientSession() as session: + await session.get('http://httpbin.org/delay/1') +``` + +**With this:** +```python +from aiohttp_client_cache import CachedSession, SQLiteBackend + +async with CachedSession(cache=SQLiteBackend('demo_cache')) as session: + await session.get('http://httpbin.org/delay/1') +``` + +The URL in this example adds a delay of 1 second, simulating a slow or rate-limited website. +With caching, the response will be fetched once, saved to `demo_cache.sqlite`, and subsequent +requests will return the cached response near-instantly. + +## Configuration +Several options are available to customize caching behavior. This example demonstrates a few of them: + +```python +# fmt: off +from aiohttp_client_cache import SQLiteBackend + +cache = SQLiteBackend( + cache_name='~/.cache/aiohttp-requests.db', # For SQLite, this will be used as the filename + expire_after=60*60, # By default, cached responses expire in an hour + urls_expire_after={'*.fillmurray.com': -1}, # Requests for any subdomain on this site will never expire + allowed_codes=(200, 418), # Cache responses with these status codes + allowed_methods=['GET', 'POST'], # Cache requests with these HTTP methods + include_headers=True, # Cache requests with different headers separately + ignored_params=['auth_token'], # Keep using the cached response even if this param changes + timeout=2.5, # Connection timeout for SQLite backend +) +``` + +# More Info +To learn more, see: +* [User Guide](https://aiohttp-client-cache.readthedocs.io/en/latest/user_guide.html) +* [Cache Backends](https://aiohttp-client-cache.readthedocs.io/en/latest/backends.html) +* [API Reference](https://aiohttp-client-cache.readthedocs.io/en/latest/reference.html) +* [Examples](https://aiohttp-client-cache.readthedocs.io/en/latest/examples.html) + + +%package help +Summary: Development documents and examples for aiohttp-client-cache +Provides: python3-aiohttp-client-cache-doc +%description help +# aiohttp-client-cache + +[](https://github.com/requests-cache/aiohttp-client-cache/actions) +[](https://aiohttp-client-cache.readthedocs.io/en/latest/) +[](https://codecov.io/gh/requests-cache/aiohttp-client-cache) +[](https://pypi.org/project/aiohttp-client-cache) +[](https://anaconda.org/conda-forge/aiohttp-client-cache) +[](https://pypi.org/project/aiohttp-client-cache) +[](https://pypi.org/project/aiohttp-client-cache) + +**aiohttp-client-cache** is an async persistent cache for [aiohttp](https://docs.aiohttp.org) +client requests, based on [requests-cache](https://github.com/reclosedev/requests-cache). + +# Features +* **Ease of use:** Use as a [drop-in replacement](https://aiohttp-client-cache.readthedocs.io/en/latest/user_guide.html) + for `aiohttp.ClientSession` +* **Customization:** Works out of the box with little to no config, but with plenty of options + available for customizing cache + [expiration](https://aiohttp-client-cache.readthedocs.io/en/latest/user_guide.html#cache-expiration) + and other [behavior](https://aiohttp-client-cache.readthedocs.io/en/latest/user_guide.html#cache-options) +* **Persistence:** Includes several [storage backends](https://aiohttp-client-cache.readthedocs.io/en/latest/backends.html): + SQLite, DynamoDB, MongoDB, and Redis. + +# Development Status +**This library is a work in progress!** + +Breaking changes should be expected until a `1.0` release, so version pinning is recommended. + +My goal for this library is to eventually have a similar (but not identical) feature set as +`requests-cache`, and also contribute new features from this library back to `requests-cache`. +If there is a feature you want, if you've discovered a bug, or if you have other general feedback, please +[create an issue](https://github.com/requests-cache/aiohttp-client-cache/issues/new/choose) for it! + +# Quickstart +First, install with pip (python 3.7+ required): +```bash +pip install aiohttp-client-cache +``` + +## Basic Usage +Next, use [aiohttp_client_cache.CachedSession](https://aiohttp-client-cache.readthedocs.io/en/latest/modules/aiohttp_client_cache.session.html#aiohttp_client_cache.session.CachedSession) +in place of [aiohttp.ClientSession](https://docs.aiohttp.org/en/stable/client_reference.html#aiohttp.ClientSession). +To briefly demonstrate how to use it: + +**Replace this:** +```python +from aiohttp import ClientSession + +async with ClientSession() as session: + await session.get('http://httpbin.org/delay/1') +``` + +**With this:** +```python +from aiohttp_client_cache import CachedSession, SQLiteBackend + +async with CachedSession(cache=SQLiteBackend('demo_cache')) as session: + await session.get('http://httpbin.org/delay/1') +``` + +The URL in this example adds a delay of 1 second, simulating a slow or rate-limited website. +With caching, the response will be fetched once, saved to `demo_cache.sqlite`, and subsequent +requests will return the cached response near-instantly. + +## Configuration +Several options are available to customize caching behavior. This example demonstrates a few of them: + +```python +# fmt: off +from aiohttp_client_cache import SQLiteBackend + +cache = SQLiteBackend( + cache_name='~/.cache/aiohttp-requests.db', # For SQLite, this will be used as the filename + expire_after=60*60, # By default, cached responses expire in an hour + urls_expire_after={'*.fillmurray.com': -1}, # Requests for any subdomain on this site will never expire + allowed_codes=(200, 418), # Cache responses with these status codes + allowed_methods=['GET', 'POST'], # Cache requests with these HTTP methods + include_headers=True, # Cache requests with different headers separately + ignored_params=['auth_token'], # Keep using the cached response even if this param changes + timeout=2.5, # Connection timeout for SQLite backend +) +``` + +# More Info +To learn more, see: +* [User Guide](https://aiohttp-client-cache.readthedocs.io/en/latest/user_guide.html) +* [Cache Backends](https://aiohttp-client-cache.readthedocs.io/en/latest/backends.html) +* [API Reference](https://aiohttp-client-cache.readthedocs.io/en/latest/reference.html) +* [Examples](https://aiohttp-client-cache.readthedocs.io/en/latest/examples.html) + + +%prep +%autosetup -n aiohttp-client-cache-0.8.1 + +%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-aiohttp-client-cache -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Fri May 05 2023 Python_Bot <Python_Bot@openeuler.org> - 0.8.1-1 +- Package Spec generated @@ -0,0 +1 @@ +1afbf2ca4908d9e9f8b09b78b9451152 aiohttp_client_cache-0.8.1.tar.gz |