You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

wrapper.py 671B

1234567891011121314151617181920212223242526272829
  1. from .adapter import CacheControlAdapter
  2. from .cache import DictCache
  3. def CacheControl(
  4. sess,
  5. cache=None,
  6. cache_etags=True,
  7. serializer=None,
  8. heuristic=None,
  9. controller_class=None,
  10. adapter_class=None,
  11. cacheable_methods=None,
  12. ):
  13. cache = cache or DictCache()
  14. adapter_class = adapter_class or CacheControlAdapter
  15. adapter = adapter_class(
  16. cache,
  17. cache_etags=cache_etags,
  18. serializer=serializer,
  19. heuristic=heuristic,
  20. controller_class=controller_class,
  21. cacheable_methods=cacheable_methods,
  22. )
  23. sess.mount("http://", adapter)
  24. sess.mount("https://", adapter)
  25. return sess