{"id":15200899,"url":"https://github.com/requests-cache/aiohttp-client-cache","last_synced_at":"2025-05-15T18:07:38.438Z","repository":{"id":37570106,"uuid":"313084240","full_name":"requests-cache/aiohttp-client-cache","owner":"requests-cache","description":"An async persistent cache for aiohttp requests","archived":false,"fork":false,"pushed_at":"2025-03-29T16:08:50.000Z","size":2090,"stargazers_count":134,"open_issues_count":12,"forks_count":22,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-01T00:32:23.591Z","etag":null,"topics":["aiohttp","async","asyncio","cache","client","dynamodb","http","mongodb","persistence","redis","requests","sqlite"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/requests-cache.png","metadata":{"files":{"readme":"README.md","changelog":"HISTORY.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"docs/security.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-11-15T17:23:39.000Z","updated_at":"2025-03-21T21:55:15.000Z","dependencies_parsed_at":"2024-02-27T01:28:17.850Z","dependency_job_id":"0abcf49c-b98b-4287-89ff-b579517bf6ae","html_url":"https://github.com/requests-cache/aiohttp-client-cache","commit_stats":{"total_commits":449,"total_committers":24,"mean_commits":"18.708333333333332","dds":"0.32071269487750553","last_synced_commit":"10a9d9f8c65ab54f65fa623b288b730db344baf0"},"previous_names":[],"tags_count":36,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/requests-cache%2Faiohttp-client-cache","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/requests-cache%2Faiohttp-client-cache/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/requests-cache%2Faiohttp-client-cache/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/requests-cache%2Faiohttp-client-cache/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/requests-cache","download_url":"https://codeload.github.com/requests-cache/aiohttp-client-cache/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247760628,"owners_count":20991517,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aiohttp","async","asyncio","cache","client","dynamodb","http","mongodb","persistence","redis","requests","sqlite"],"created_at":"2024-09-28T03:01:29.344Z","updated_at":"2025-04-08T01:34:18.444Z","avatar_url":"https://github.com/requests-cache.png","language":"Python","readme":"# aiohttp-client-cache\n\n[![Build status](https://github.com/requests-cache/aiohttp-client-cache/actions/workflows/build.yml/badge.svg?branch=main)](https://github.com/requests-cache/aiohttp-client-cache/actions)\n[![Documentation Status](https://img.shields.io/readthedocs/aiohttp-client-cache/latest?label=docs)](https://aiohttp-client-cache.readthedocs.io/en/stable/)\n[![Codecov](https://codecov.io/gh/requests-cache/aiohttp-client-cache/branch/main/graph/badge.svg?token=I6PNLYTILM)](https://codecov.io/gh/requests-cache/aiohttp-client-cache)\n[![PyPI](https://img.shields.io/pypi/v/aiohttp-client-cache?color=blue)](https://pypi.org/project/aiohttp-client-cache)\n[![Conda](https://img.shields.io/conda/vn/conda-forge/aiohttp-client-cache?color=blue)](https://anaconda.org/conda-forge/aiohttp-client-cache)\n[![PyPI - Python Versions](https://img.shields.io/pypi/pyversions/aiohttp-client-cache)](https://pypi.org/project/aiohttp-client-cache)\n[![PyPI - Format](https://img.shields.io/pypi/format/aiohttp-client-cache?color=blue)](https://pypi.org/project/aiohttp-client-cache)\n\n**aiohttp-client-cache** is an async persistent cache for [aiohttp](https://docs.aiohttp.org)\nclient requests, based on [requests-cache](https://github.com/reclosedev/requests-cache).\n\n# Features\n\n- **Ease of use:** Use as a [drop-in replacement](https://aiohttp-client-cache.readthedocs.io/en/stable/user_guide.html)\n  for `aiohttp.ClientSession`\n- **Customization:** Works out of the box with little to no config, but with plenty of options\n  available for customizing cache\n  [expiration](https://aiohttp-client-cache.readthedocs.io/en/stable/user_guide.html#cache-expiration)\n  and other [behavior](https://aiohttp-client-cache.readthedocs.io/en/stable/user_guide.html#cache-options)\n- **Persistence:** Includes several [storage backends](https://aiohttp-client-cache.readthedocs.io/en/stable/backends.html):\n  SQLite, DynamoDB, MongoDB, DragonflyDB and Redis.\n\n# Quickstart\n\nFirst, install with pip (python 3.9+ required):\n\n```bash\npip install aiohttp-client-cache[all]\n```\n\n**Note:**\nAdding `[all]` will install optional dependencies for all supported backends. When adding this\nlibrary to your application, you can include only the dependencies you actually need; see individual\nbackend docs and [pyproject.toml](https://github.com/requests-cache/aiohttp-client-cache/blob/main/pyproject.toml)\nfor details.\n\n## Basic Usage\n\nNext, use [aiohttp_client_cache.CachedSession](https://aiohttp-client-cache.readthedocs.io/en/stable/modules/aiohttp_client_cache.session.html#aiohttp_client_cache.session.CachedSession)\nin place of [aiohttp.ClientSession](https://docs.aiohttp.org/en/stable/client_reference.html#aiohttp.ClientSession).\nTo briefly demonstrate how to use it:\n\n**Replace this:**\n\n```python\nfrom aiohttp import ClientSession\n\nasync with ClientSession() as session:\n    await session.get('http://httpbin.org/delay/1')\n```\n\n**With this:**\n\n```python\nfrom aiohttp_client_cache import CachedSession, SQLiteBackend\n\nasync with CachedSession(cache=SQLiteBackend('demo_cache')) as session:\n    await session.get('http://httpbin.org/delay/1')\n```\n\nThe URL in this example adds a delay of 1 second, simulating a slow or rate-limited website.\nWith caching, the response will be fetched once, saved to `demo_cache.sqlite`, and subsequent\nrequests will return the cached response near-instantly.\n\n## Configuration\n\nSeveral options are available to customize caching behavior. This example demonstrates a few of them:\n\n```python\n# fmt: off\nfrom aiohttp_client_cache import SQLiteBackend\n\ncache = SQLiteBackend(\n    cache_name='~/.cache/aiohttp-requests.db',  # For SQLite, this will be used as the filename\n    expire_after=60*60,                         # By default, cached responses expire in an hour\n    urls_expire_after={'*.fillmurray.com': -1}, # Requests for any subdomain on this site will never expire\n    allowed_codes=(200, 418),                   # Cache responses with these status codes\n    allowed_methods=['GET', 'POST'],            # Cache requests with these HTTP methods\n    include_headers=True,                       # Cache requests with different headers separately\n    ignored_params=['auth_token'],              # Keep using the cached response even if this param changes\n    timeout=2.5,                                # Connection timeout for SQLite backend\n)\n```\n\n# More Info\n\nTo learn more, see:\n\n- [User Guide](https://aiohttp-client-cache.readthedocs.io/en/stable/user_guide.html)\n- [Cache Backends](https://aiohttp-client-cache.readthedocs.io/en/stable/backends.html)\n- [API Reference](https://aiohttp-client-cache.readthedocs.io/en/stable/reference.html)\n- [Examples](https://aiohttp-client-cache.readthedocs.io/en/stable/examples.html)\n\n# Feedback\n\nIf there is a feature you want, if you've discovered a bug, or if you have other general feedback, please\n[create an issue](https://github.com/requests-cache/aiohttp-client-cache/issues/new/choose) for it!\n","funding_links":[],"categories":["Python"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frequests-cache%2Faiohttp-client-cache","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frequests-cache%2Faiohttp-client-cache","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frequests-cache%2Faiohttp-client-cache/lists"}