Simple caching transport for httpx

Overview

HTTPX-CACHE

codecov

Note: Early development / alpha, use at your own risk.

httpx-cache is yet another implementation/port is a port of the caching algorithms in httplib2 for use with httpx Transport object.

It is is heavily insipired by:

This project supports the latest version of httpx (at of the time of writing): [email protected], when httpx releases a v1 version, the update should be straithforward for this project.

Installation

Using pip:

pip install httpx-cache

Using poetry:

poetry add httpx-cache

Features

  • In memory dict cache store
  • Support for cache-controle headers
  • Sync cache transport for httpx
  • Async cache transport for httpx

Quickstart

The lib provides an httpx compliant transport that you can use instead of the the defult one when creating your httpx client:

import httpx

from httpx_cache import CacheControlTransport

with httpx.Client(transport=CacheControlTransport()) as client:
  response = client.get("https://httpbin.org/get")

  # the response is effectively cached, calling teh same request with return a response from the cache

  response2 = client.get("https://httpbin.org/get")

You can also wrap an existing transport with CacheControlTransport. The CacheControlTransport will use the existing transport for making the request call and then cach the result if it satisfies the cache-control headers.

import httpx

from httpx_cache import CacheControlTransport

my_transport = httpx.HTTPTransport(http2=True, verify=False)

with httpx.Client(transport=CacheControlTransport(transport=my_transport)) as client:
  response = client.get("https://httpbin.org/get")

  # the response is effectively cached, calling teh same request with return a response from the cache

  response2 = client.get("https://httpbin.org/get")

Examples

more examples in ./examples.

TODO

  • support etags
  • support cache expiry dates
  • support file cach
  • support redis (sync/async) cache
Comments
  • filecache: create parent directories as well

    filecache: create parent directories as well

    First off, thank you for the very nice project!

    Running this on Windows I initially got an error because %USER%/.cache did not exist, so here's a simple fix. :)

    opened by mhils 3
  • You have an undeclared dependency on attrs

    You have an undeclared dependency on attrs

    Describe the bug A clear and concise description of what the bug is.

    Hey there! I was using your project and couldn't figure out why I was getting weird errors that didn't show up in my dev environment.

    It seems like you use attrs but don't declare it as a dependency in pyproject.toml, my dev environment had it in from some other project hence why I only saw the errors once I installed my project outside the dev environment.

    Imported here: https://github.com/obendidi/httpx-cache/blob/7789306f6b04023f2149d9b153c7d0ad134b5372/httpx_cache/utils.py#L8

    Used here: https://github.com/obendidi/httpx-cache/blob/7789306f6b04023f2149d9b153c7d0ad134b5372/httpx_cache/utils.py#L94

    But it's not listed in dependencies in pyproject.toml here: https://github.com/obendidi/httpx-cache/blob/7789306f6b04023f2149d9b153c7d0ad134b5372/pyproject.toml#L30

    When I ran my project I got ModuleNotFoundError and traced it back here.

    Expected behavior A clear and concise description of what you expected to happen.

    The dependency should be declared in pyproject.toml

    Screenshots If applicable, add screenshots to help explain your problem.

    I forgot to grab any screenshots but I hope the problem is clear

    Desktop (please complete the following information):

    • OS: [e.g. iOS] MacOS
    • Version [e.g. 22] Python 3.10.1

    Additional context Add any other context about the problem here.

    opened by FollowTheProcess 3
  • Bump nox from 2022.1.7 to 2022.11.21

    Bump nox from 2022.1.7 to 2022.11.21

    Bumps nox from 2022.1.7 to 2022.11.21.

    Release notes

    Sourced from nox's releases.

    2022.11.21 🦃

    We'd like to thank the following folks who contributed to this release:

    New features:

    • Include Python 3.11 classifier & testing (#655)

    Improvements:

    • Fixed a few typos (#661, #660)
    • Drop dependency on py (#647)
    • nox.session.run now accepts a pathlib.Path for the command (#649)
    • Document nox.session.run's stdout and stderr arguments and add example of capturing output (#651)

    Bugfixes:

    • GitHub Action: replace deprecated set-output command (#668)
    • GitHub Action: point docs to 2022.8.7 not latest (#664)
    • Docs: fix argument passing in session.posargs example (#653)
    • Include GitHub action helper in MANIFEST.in (#645)

    Internal changes:

    • GitHub Action: move to 3.11 final (#667)
    • Cleanup Python 2 style code (#657)
    • Update tools used in pre-commit (#646, #656)

    2022.8.7 🧚

    We'd like to thank the following folks who contributed to this release:

    Removals:

    ... (truncated)

    Changelog

    Sourced from nox's changelog.

    2022.11.21

    We'd like to thank the following folks who contributed to this release:

    New features:

    • Include Python 3.11 classifier & testing (#655)

    Improvements:

    • Fixed a few typos (#661, #660)
    • Drop dependency on py (#647)
    • nox.session.run now accepts a pathlib.Path for the command (#649)
    • Document nox.session.run's stdout and stderr arguments and add example of capturing output (#651)

    Bugfixes:

    • GitHub Action: replace deprecated set-output command (#668)
    • GitHub Action: point docs to 2022.8.7 not latest (#664)
    • Docs: fix argument passing in session.posargs example (#653)
    • Include GitHub action helper in MANIFEST.in (#645)

    Internal changes:

    • GitHub Action: move to 3.11 final (#667)
    • Cleanup Python 2 style code (#657)
    • Update tools used in pre-commit (#646, #656)

    2022.8.7

    We'd like to thank the following folks who contributed to this release:

    ... (truncated)

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies 
    opened by dependabot[bot] 2
  • Bump flake8 from 4.0.1 to 5.0.2

    Bump flake8 from 4.0.1 to 5.0.2

    Bumps flake8 from 4.0.1 to 5.0.2.

    Commits
    • 70c0b3d Release 5.0.2
    • 5e69ba9 Merge pull request #1642 from PyCQA/no-home
    • 8b51ee4 skip skipping home if home does not exist
    • 446b18d Merge pull request #1641 from PyCQA/entry-points-not-pickleable
    • b70d7a2 work around un-pickleabiliy of EntryPoint in 3.8.0
    • 91a7fa9 fix order of release notes
    • 405cfe0 Release 5.0.1
    • d20bb97 Merge pull request #1631 from PyCQA/dupe-sys-path
    • fce93b9 prevent duplicate plugin discovery on misconfigured pythons
    • 3f4872a Merge pull request #1628 from mxr/patch-1
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies 
    opened by dependabot[bot] 2
  • Bump trio from 0.19.0 to 0.21.0

    Bump trio from 0.19.0 to 0.21.0

    Bumps trio from 0.19.0 to 0.21.0.

    Commits
    • 077e8fc Bump version to 0.21.0
    • 8ede49a Merge pull request #2340 from pquentin/spdx-compliant-license
    • 4048fc4 Merge pull request #2341 from python-trio/dependabot/pip/mypy-0.961
    • 83d5313 Merge pull request #2342 from python-trio/dependabot/pip/pylint-2.14.1
    • 7cb3ef9 Bump pylint from 2.13.9 to 2.14.1
    • 6676d74 Bump mypy from 0.960 to 0.961
    • ac72b60 Make setuptools license field SPDX-compliant
    • bcaa10a Merge pull request #2328 from python-trio/dependabot/pip/mypy-0.960
    • 98c7897 Bump mypy from 0.950 to 0.960
    • 4ff5b43 Merge pull request #2326 from python-trio/dependabot/pip/dill-0.3.5.1
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies 
    opened by dependabot[bot] 2
  • Bump mypy from 0.931 to 0.971

    Bump mypy from 0.931 to 0.971

    Bumps mypy from 0.931 to 0.971.

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies 
    opened by dependabot[bot] 2
  • Bump black from 21.12b0 to 22.6.0

    Bump black from 21.12b0 to 22.6.0

    Bumps black from 21.12b0 to 22.6.0.

    Release notes

    Sourced from black's releases.

    22.6.0

    Style

    • Fix unstable formatting involving #fmt: skip and # fmt:skip comments (notice the lack of spaces) (#2970)

    Preview style

    • Docstring quotes are no longer moved if it would violate the line length limit (#3044)
    • Parentheses around return annotations are now managed (#2990)
    • Remove unnecessary parentheses around awaited objects (#2991)
    • Remove unnecessary parentheses in with statements (#2926)
    • Remove trailing newlines after code block open (#3035)

    Integrations

    • Add scripts/migrate-black.py script to ease introduction of Black to a Git project (#3038)

    Output

    • Output Python version and implementation as part of --version flag (#2997)

    Packaging

    • Use tomli instead of tomllib on Python 3.11 builds where tomllib is not available (#2987)

    Parser

    • PEP 654 syntax (for example, except *ExceptionGroup:) is now supported (#3016)
    • PEP 646 syntax (for example, Array[Batch, *Shape] or def fn(*args: *T) -> None) is now supported (#3071)

    Vim Plugin

    • Fix strtobool function. It didn't parse true/on/false/off. (#3025)

    Full Changelog: https://github.com/psf/black/compare/22.3.0...22.6.0


    Thank you!

    • @​jpy-git for improving our parentheses formatting significantly
    • @​siuryan for fixing a fmt: skip bug, making it a little less annoying to use :)
    • @​isidentical for implementing support for PEP 654 and 646 syntax
    • @​defntvdm for fixing our vim plugin, especially as we (the maintainers) don't really know vim script sadly
    • @​idorrington92 for fixing the docstring bug where Black would move the closing quotes causing it to violate the line length limit (whoops!)
    • @​hbrunn for contributing the migrate-black script
    • @​saroad2 for improving newline handling after code blocks and test infrastructure improvements

    ... and everyone else who contributed documentation, tests, or other improvements to the Black project!

    ... (truncated)

    Changelog

    Sourced from black's changelog.

    22.6.0

    Style

    • Fix unstable formatting involving #fmt: skip and # fmt:skip comments (notice the lack of spaces) (#2970)

    Preview style

    • Docstring quotes are no longer moved if it would violate the line length limit (#3044)
    • Parentheses around return annotations are now managed (#2990)
    • Remove unnecessary parentheses around awaited objects (#2991)
    • Remove unnecessary parentheses in with statements (#2926)
    • Remove trailing newlines after code block open (#3035)

    Integrations

    • Add scripts/migrate-black.py script to ease introduction of Black to a Git project (#3038)

    Output

    • Output Python version and implementation as part of --version flag (#2997)

    Packaging

    • Use tomli instead of tomllib on Python 3.11 builds where tomllib is not available (#2987)

    Parser

    • PEP 654 syntax (for example, except *ExceptionGroup:) is now supported (#3016)
    • PEP 646 syntax (for example, Array[Batch, *Shape] or def fn(*args: *T) -> None) is now supported (#3071)

    Vim Plugin

    • Fix strtobool function. It didn't parse true/on/false/off. (#3025)

    22.3.0

    Preview style

    • Code cell separators #%% are now standardised to # %% (#2919)
    • Remove unnecessary parentheses from except statements (#2939)
    • Remove unnecessary parentheses from tuple unpacking in for loops (#2945)
    • Avoid magic-trailing-comma in single-element subscripts (#2942)

    Configuration

    ... (truncated)

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies 
    opened by dependabot[bot] 2
  • Bump rich from 12.0.1 to 12.1.0

    Bump rich from 12.0.1 to 12.1.0

    Bumps rich from 12.0.1 to 12.1.0.

    Release notes

    Sourced from rich's releases.

    Export SVGs and file progress

    Snap export svg Snap

    [12.1.0] - 2022-04-03

    Added

    Fixed

    Changelog

    Sourced from rich's changelog.

    [12.1.0] - 2022-04-03

    Added

    • Progress.open and Progress.wrap_file method to track the progress while reading from a file or file-like object willmcgugan/rich#1759
    • SVG export functionality Textualize/rich#2101
    • Adding Indonesian translation

    Fixed

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies 
    opened by dependabot[bot] 2
  • Bump pytest-cases from 3.6.8 to 3.6.13

    Bump pytest-cases from 3.6.8 to 3.6.13

    Bumps pytest-cases from 3.6.8 to 3.6.13.

    Release notes

    Sourced from pytest-cases's releases.

    3.6.13 - bugfix

    • Fixed issue where a lazy value (for example a case function) was not resolved before being injected in a parametrized function, and was therefore appearing as a _LazyValueCaseParamValue . Fixed #274

    See documentation page for details.

    3.6.12 - type hint fix + enhanced compatibility with pytest plugins

    • Improved compatibility with other pytest plugins, in particular pytest-repeat, by supporting removal from fixture closure tree. Fixed #269.
    • Fixed type hint errors detected by pyright. Fixed #270

    See documentation page for details.

    3.6.11 - bugfix for pytest-xdist and get_all_cases API improvement

    • get_all_cases can now be called without parametrization_target (defaulting to the caller module), and with an explicit module object. Fixed #258. PR #260 by @​eddiebergman.
    • Fixed AttributeError: module 'pytest_cases' has no attribute 'CasesCollectionWarning' when running pytest-xdist and at least one cases class is ignored because of __init__ or __new__. Fixed #249.

    See documentation page for details.

    3.6.9 - Bugfix with pytest 7

    See documentation page for details.

    Changelog

    Sourced from pytest-cases's changelog.

    3.6.13 - bugfix

    • Fixed issue where a lazy value (for example a case function) was not resolved before being injected in a parametrized function, and was therefore appearing as a _LazyValueCaseParamValue . Fixed #274

    3.6.12 - type hint fix + enhanced compatibility with pytest plugins

    • Improved compatibility with other pytest plugins, in particular pytest-repeat, by supporting removal from fixture closure tree. Fixed #269.
    • Fixed type hint errors detected by pyright. Fixed #270

    3.6.11 - bugfix for pytest-xdist and get_all_cases API improvement

    • get_all_cases can now be called without parametrization_target (defaulting to the caller module), and with an explicit module object. Fixed #258. PR #260 by @​eddiebergman.
    • Fixed AttributeError: module 'pytest_cases' has no attribute 'CasesCollectionWarning' when running pytest-xdist and at least one cases class is ignored because of __init__ or __new__. Fixed #249.

    3.6.10 - bugfix for pytest 7.1

    3.6.9 - Bugfix with pytest 7

    Commits
    • 4f5c466 Fixed lazy value resolution issue when multiple consecutive lazy values are p...
    • 0ef1a0e Update changelog.md
    • 846af99 minor changelog title edit
    • d3cf756 [WIP] Support removal from fixture closure tree to improve compatibility with...
    • 2383167 Fixed type hint errors detected by pyright. Fixed #270 (#271)
    • def94ce Fixed and updated import_default_cases_module
    • cadffa2 3.6.11 changelog
    • 05d7998 Doc: Add documentation for parametrize_all_cases and get_all_cases (#259)
    • e960630 Add: get_all_cases extended to support filtering and use other modules as `...
    • 904b02a Fixed AttributeError: module 'pytest_cases' has no attribute 'CasesCollecti...
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies 
    opened by dependabot[bot] 2
  • Bump types-mock from 4.0.8 to 4.0.14

    Bump types-mock from 4.0.8 to 4.0.14

    Bumps types-mock from 4.0.8 to 4.0.14.

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies 
    opened by dependabot[bot] 2
  • Use aiorwlock for async file caches

    Use aiorwlock for async file caches

    Context

    https://github.com/obendidi/httpx-cache/discussions/45

    Proposal

    Use aiorwlock as the async file cache lock, it allows to maintains a pair of associated locks, one for read-only operations and one for writing. The read lock may be held simultaneously by multiple reader tasks, so long as there are no writers. The write lock is exclusive.

    TODO

    • Make conditional dependency between python < 3.7 and python > 3.7
    • check if t can easily support trio back-end
    opened by obendidi 2
  • Hope to use redis cache

    Hope to use redis cache

    Great job, giving httpx the ability to cache. It is very helpful in crawling crawler. At present, with the development of distributed crawler, local file cache is difficult to help distributed crawler speed up. It is recommended to implement redis cache

    opened by EchoShoot 1
Releases(v0.7.0)
  • v0.7.0(Dec 4, 2022)

    What's Changed

    • Bump attrs from 21.4.0 to 22.1.0 by @dependabot in https://github.com/obendidi/httpx-cache/pull/63
    • Switch from poetry to hatch for managing and building project

    Full Changelog: https://github.com/obendidi/httpx-cache/compare/v0.6.1...v0.7.0

    Source code(tar.gz)
    Source code(zip)
  • v0.6.1(Oct 9, 2022)

    What's Changed

    • filecache: create parent directories as well by @mhils in https://github.com/obendidi/httpx-cache/pull/69

    New Contributors

    • @mhils made their first contribution in https://github.com/obendidi/httpx-cache/pull/69

    Full Changelog: https://github.com/obendidi/httpx-cache/compare/v0.6.0...v0.6.1

    Source code(tar.gz)
    Source code(zip)
  • v0.6.0(Jul 28, 2022)

    What's Changed

    • update httpx version to 0.23 by @obendidi in https://github.com/obendidi/httpx-cache/pull/61

    Full Changelog: https://github.com/obendidi/httpx-cache/compare/v0.5.0...v0.6.0

    Source code(tar.gz)
    Source code(zip)
  • v0.5.0(May 31, 2022)

    What's Changed

    • Bump pre-commit from 2.16.0 to 2.17.0 by @dependabot in https://github.com/obendidi/httpx-cache/pull/24
    • Bump mkdocs-material from 8.1.7 to 8.1.8 by @dependabot in https://github.com/obendidi/httpx-cache/pull/25
    • Bump rich from 11.0.0 to 12.0.1 by @dependabot in https://github.com/obendidi/httpx-cache/pull/42
    • Bump httpx from 0.21.3 to 0.22.0 by @dependabot in https://github.com/obendidi/httpx-cache/pull/28
    • Bump anyio from 3.5.0 to 3.6.1 by @dependabot in https://github.com/obendidi/httpx-cache/pull/51
    • Use aiorwlock for async file caches by @obendidi in https://github.com/obendidi/httpx-cache/pull/48
    • Bump pytest from 6.2.5 to 7.0.1 by @dependabot in https://github.com/obendidi/httpx-cache/pull/49

    Full Changelog: https://github.com/obendidi/httpx-cache/compare/v0.4.1...v0.5.0

    Source code(tar.gz)
    Source code(zip)
  • v0.4.1(Jan 21, 2022)

    What's Changed

    • Bump rich from 10.16.1 to 10.16.2 by @dependabot in https://github.com/obendidi/httpx-cache/pull/10
    • Bump mypy from 0.910 to 0.930 by @dependabot in https://github.com/obendidi/httpx-cache/pull/8
    • Bump mkdocs-material from 8.1.3 to 8.1.4 by @dependabot in https://github.com/obendidi/httpx-cache/pull/9
    • Bump pytest-cases from 3.6.5 to 3.6.7 by @dependabot in https://github.com/obendidi/httpx-cache/pull/7
    • Bump trio-typing from 0.6.0 to 0.7.0 by @dependabot in https://github.com/obendidi/httpx-cache/pull/6
    • Bump rich from 10.16.2 to 11.0.0 by @dependabot in https://github.com/obendidi/httpx-cache/pull/12
    • Bump httpx from 0.21.1 to 0.21.3 by @dependabot in https://github.com/obendidi/httpx-cache/pull/11
    • Bump types-mock from 4.0.5 to 4.0.8 by @dependabot in https://github.com/obendidi/httpx-cache/pull/13
    • Bump nox from 2021.10.1 to 2022.1.7 by @dependabot in https://github.com/obendidi/httpx-cache/pull/15
    • Bump respx from 0.19.0 to 0.19.1 by @dependabot in https://github.com/obendidi/httpx-cache/pull/14
    • Explicitly add attrs dependency by @FollowTheProcess in https://github.com/obendidi/httpx-cache/pull/22
    • Bump mkdocs-material from 8.1.4 to 8.1.7 by @dependabot in https://github.com/obendidi/httpx-cache/pull/17
    • Bump anyio from 3.4.0 to 3.5.0 by @dependabot in https://github.com/obendidi/httpx-cache/pull/19
    • Bump fasteners from 0.16.3 to 0.17.2 by @dependabot in https://github.com/obendidi/httpx-cache/pull/20
    • Bump mypy from 0.930 to 0.931 by @dependabot in https://github.com/obendidi/httpx-cache/pull/16
    • Bump pytest-cases from 3.6.7 to 3.6.8 by @dependabot in https://github.com/obendidi/httpx-cache/pull/18
    • Add python-3.10 to test matrix in CI by @obendidi in https://github.com/obendidi/httpx-cache/pull/23

    New Contributors

    • @dependabot made their first contribution in https://github.com/obendidi/httpx-cache/pull/10
    • @FollowTheProcess made their first contribution in https://github.com/obendidi/httpx-cache/pull/22

    Full Changelog: https://github.com/obendidi/httpx-cache/compare/v0.4.0...v0.4.1

    Source code(tar.gz)
    Source code(zip)
  • v0.4.0(Dec 31, 2021)

    What's Changed

    • Update Documentation
    • Add new object httpx_cache.Client to crate a client with caching transports

    Full Changelog: https://github.com/obendidi/httpx-cache/compare/v0.3.0...v0.4.0

    Source code(tar.gz)
    Source code(zip)
  • v0.3.0(Dec 25, 2021)

    • Major refactor of the lib
    • Tests coverage 99.8%
    • New feature: full support for cache-control headers (no-cache, no-store, max-age, max-stale, expires, ...)
    Source code(tar.gz)
    Source code(zip)
  • v0.2.0(Dec 19, 2021)

    What's Changed

    • Add 'Filecache' support by @obendidi in https://github.com/obendidi/httpx-cache/pull/2
    • Feature/refactor by @obendidi in https://github.com/obendidi/httpx-cache/pull/3

    Full Changelog: https://github.com/obendidi/httpx-cache/compare/v0.1.0...v0.2.0

    Source code(tar.gz)
    Source code(zip)
  • v0.1.0(Dec 12, 2021)

Owner
Ouail
Data engineer, MLOps, Machine learning
Ouail
Caching for HTTPX

Caching for HTTPX. Note: Early development / alpha, use at your own risk. This package adds caching functionality to HTTPX Adapted from Eric Larson's

Johannes 51 Dec 04, 2022
A caching extension for Flask

A fork of the Flask-cache extension which adds easy cache support to Flask.

Pallets Community 773 Jan 08, 2023
johnny cache django caching framework

Johnny Cache is a caching framework for django applications. It works with the django caching abstraction, but was developed specifically with the use

Jason Moiron 304 Nov 07, 2022
An ORM cache for Django.

Django ORMCache A cache manager mixin that provides some caching of objects for the ORM. Installation / Setup / Usage TODO Testing Run the tests with:

Educreations, Inc 15 Nov 27, 2022
WSGI middleware for sessions and caching

Cache and Session Library About Beaker is a web session and general caching library that includes WSGI middleware for use in web applications. As a ge

Ben Bangert 500 Dec 29, 2022
Python disk-backed cache (Django-compatible). Faster than Redis and Memcached. Pure-Python.

DiskCache is an Apache2 licensed disk and file backed cache library, written in pure-Python, and compatible with Django.

Grant Jenks 1.7k Jan 05, 2023
Persistent, stale-free, local and cross-machine caching for Python functions.

Persistent, stale-free, local and cross-machine caching for Python functions.

Shay Palachy 420 Dec 22, 2022
A decorator for caching properties in classes.

cached-property A decorator for caching properties in classes. Why? Makes caching of time or computational expensive properties quick and easy. Becaus

Daniel Roy Greenfeld 658 Dec 01, 2022
Render template parts with extended cache control.

Render template parts with extended cache control. Installation Install django-viewlet in your python environment $ pip install django-viewlet Support

5 Monkeys 59 Apr 05, 2022
Asyncio cache manager for redis, memcached and memory

aiocache Asyncio cache supporting multiple backends (memory, redis and memcached). This library aims for simplicity over specialization. All caches co

aio-libs 764 Jan 02, 2023
PyCache - simple key:value server written with Python

PyCache simple key:value server written with Python and client is here run server python -m pycache.server or from pycache.server import start_server

chick_0 0 Nov 01, 2022
No effort, no worry, maximum performance.

Django Cachalot Caches your Django ORM queries and automatically invalidates them. Documentation: http://django-cachalot.readthedocs.io Table of Conte

NoriPyt 976 Dec 28, 2022
An implementation of memoization technique for Django

django-memoize django-memoize is an implementation of memoization technique for Django. You can think of it as a cache for function or method results.

Unhaggle 118 Dec 09, 2022
No effort, no worry, maximum performance.

Django Cachalot Caches your Django ORM queries and automatically invalidates them. Documentation: http://django-cachalot.readthedocs.io Table of Conte

NoriPyt 979 Jan 03, 2023
RecRoom Library Cache Tool

RecRoom Library Cache Tool A handy tool to deal with the Library cache file. Features Parse Library cache Remove Library cache Parsing The script pars

Jesse 5 Jul 09, 2022
Aircache is an open-source caching and security solution that can be integrated with most decoupled apps that use REST APIs for communicating.

AirCache Aircache is an open-source caching and security solution that can be integrated with most decoupled apps that use REST APIs for communicating

AirCache 2 Dec 22, 2021
Peerix is a peer-to-peer binary cache for nix derivations

Peerix Peerix is a peer-to-peer binary cache for nix derivations. Every participating node can pull derivations from each other instances' respective

92 Dec 13, 2022
Automatic Flask cache configuration on Heroku.

flask-heroku-cacheify Automatic Flask cache configuration on Heroku. Purpose Configuring your cache on Heroku can be a time sink. There are lots of di

Randall Degges 39 Jun 05, 2022
CacheControl is a port of the caching algorithms in httplib2 for use with requests session object.

CacheControl CacheControl is a port of the caching algorithms in httplib2 for use with requests session object. It was written because httplib2's bett

Eric Larson 409 Dec 04, 2022
Asynchronous cache manager designed for horizontally scaled web servers.

Introduction Asynchronous cache manager designed for horizontally scaled web applications. NOTE: Currently has implementation only for FastAPI using R

Serghei 23 Dec 01, 2022