requests-cache 1.2.0__tar.gz → 1.2.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (203) hide show
  1. {requests_cache-1.2.0 → requests_cache-1.2.1}/CONTRIBUTORS.md +6 -4
  2. {requests_cache-1.2.0 → requests_cache-1.2.1}/HISTORY.md +9 -0
  3. {requests_cache-1.2.0 → requests_cache-1.2.1}/PKG-INFO +1 -1
  4. {requests_cache-1.2.0 → requests_cache-1.2.1}/docs/conf.py +1 -0
  5. {requests_cache-1.2.0 → requests_cache-1.2.1}/docs/user_guide/expiration.md +2 -2
  6. {requests_cache-1.2.0 → requests_cache-1.2.1}/docs/user_guide/general.md +1 -1
  7. {requests_cache-1.2.0 → requests_cache-1.2.1}/docs/user_guide/matching.md +1 -1
  8. {requests_cache-1.2.0 → requests_cache-1.2.1}/docs/user_guide/troubleshooting.md +1 -1
  9. {requests_cache-1.2.0 → requests_cache-1.2.1}/pyproject.toml +6 -4
  10. {requests_cache-1.2.0 → requests_cache-1.2.1}/requests_cache/__init__.py +1 -1
  11. {requests_cache-1.2.0 → requests_cache-1.2.1}/requests_cache/_utils.py +2 -1
  12. {requests_cache-1.2.0 → requests_cache-1.2.1}/requests_cache/backends/__init__.py +1 -0
  13. {requests_cache-1.2.0 → requests_cache-1.2.1}/requests_cache/backends/base.py +1 -0
  14. {requests_cache-1.2.0 → requests_cache-1.2.1}/requests_cache/backends/dynamodb.py +1 -0
  15. {requests_cache-1.2.0 → requests_cache-1.2.1}/requests_cache/backends/filesystem.py +1 -0
  16. {requests_cache-1.2.0 → requests_cache-1.2.1}/requests_cache/backends/gridfs.py +5 -4
  17. {requests_cache-1.2.0 → requests_cache-1.2.1}/requests_cache/backends/mongodb.py +6 -5
  18. {requests_cache-1.2.0 → requests_cache-1.2.1}/requests_cache/backends/redis.py +1 -0
  19. {requests_cache-1.2.0 → requests_cache-1.2.1}/requests_cache/backends/sqlite.py +5 -4
  20. {requests_cache-1.2.0 → requests_cache-1.2.1}/requests_cache/cache_keys.py +2 -0
  21. {requests_cache-1.2.0 → requests_cache-1.2.1}/requests_cache/models/__init__.py +1 -0
  22. {requests_cache-1.2.0 → requests_cache-1.2.1}/requests_cache/models/response.py +6 -6
  23. {requests_cache-1.2.0 → requests_cache-1.2.1}/requests_cache/patcher.py +5 -3
  24. {requests_cache-1.2.0 → requests_cache-1.2.1}/requests_cache/policy/__init__.py +1 -0
  25. {requests_cache-1.2.0 → requests_cache-1.2.1}/requests_cache/policy/expiration.py +1 -0
  26. {requests_cache-1.2.0 → requests_cache-1.2.1}/requests_cache/serializers/__init__.py +1 -0
  27. {requests_cache-1.2.0 → requests_cache-1.2.1}/requests_cache/serializers/cattrs.py +6 -4
  28. {requests_cache-1.2.0 → requests_cache-1.2.1}/requests_cache/serializers/pipeline.py +1 -0
  29. {requests_cache-1.2.0 → requests_cache-1.2.1}/requests_cache/serializers/preconf.py +1 -0
  30. {requests_cache-1.2.0 → requests_cache-1.2.1}/requests_cache/session.py +1 -0
  31. {requests_cache-1.2.0 → requests_cache-1.2.1}/tests/benchmark_serializers.py +1 -0
  32. {requests_cache-1.2.0 → requests_cache-1.2.1}/tests/compat/httpbin_sample.test-db +0 -0
  33. {requests_cache-1.2.0 → requests_cache-1.2.1}/tests/compat/test_requests_mock_combine_cache.py +1 -0
  34. {requests_cache-1.2.0 → requests_cache-1.2.1}/tests/compat/test_requests_mock_disable_cache.py +1 -0
  35. {requests_cache-1.2.0 → requests_cache-1.2.1}/tests/compat/test_requests_mock_load_cache.py +1 -0
  36. {requests_cache-1.2.0 → requests_cache-1.2.1}/tests/compat/test_responses_load_cache.py +4 -1
  37. {requests_cache-1.2.0 → requests_cache-1.2.1}/tests/conftest.py +9 -2
  38. {requests_cache-1.2.0 → requests_cache-1.2.1}/tests/generate_test_db.py +1 -0
  39. {requests_cache-1.2.0 → requests_cache-1.2.1}/tests/integration/base_cache_test.py +9 -5
  40. {requests_cache-1.2.0 → requests_cache-1.2.1}/tests/integration/base_storage_test.py +1 -0
  41. {requests_cache-1.2.0 → requests_cache-1.2.1}/tests/unit/test_base_cache.py +1 -0
  42. {requests_cache-1.2.0 → requests_cache-1.2.1}/tests/unit/test_cache_keys.py +24 -8
  43. {requests_cache-1.2.0 → requests_cache-1.2.1}/tests/unit/test_session.py +1 -0
  44. {requests_cache-1.2.0 → requests_cache-1.2.1}/.readthedocs.yml +0 -0
  45. {requests_cache-1.2.0 → requests_cache-1.2.1}/CONTRIBUTING.md +0 -0
  46. {requests_cache-1.2.0 → requests_cache-1.2.1}/LICENSE +0 -0
  47. {requests_cache-1.2.0 → requests_cache-1.2.1}/README.md +0 -0
  48. {requests_cache-1.2.0 → requests_cache-1.2.1}/docker-compose.yml +0 -0
  49. {requests_cache-1.2.0 → requests_cache-1.2.1}/docs/404.rst +0 -0
  50. {requests_cache-1.2.0 → requests_cache-1.2.1}/docs/Dockerfile +0 -0
  51. {requests_cache-1.2.0 → requests_cache-1.2.1}/docs/_static/dynamodb.png +0 -0
  52. {requests_cache-1.2.0 → requests_cache-1.2.1}/docs/_static/dynamodb_32px.png +0 -0
  53. {requests_cache-1.2.0 → requests_cache-1.2.1}/docs/_static/dynamodb_create_table.png +0 -0
  54. {requests_cache-1.2.0 → requests_cache-1.2.1}/docs/_static/dynamodb_items.png +0 -0
  55. {requests_cache-1.2.0 → requests_cache-1.2.1}/docs/_static/dynamodb_response.png +0 -0
  56. {requests_cache-1.2.0 → requests_cache-1.2.1}/docs/_static/favicon.ico +0 -0
  57. {requests_cache-1.2.0 → requests_cache-1.2.1}/docs/_static/file-json.png +0 -0
  58. {requests_cache-1.2.0 → requests_cache-1.2.1}/docs/_static/file-json_32px.png +0 -0
  59. {requests_cache-1.2.0 → requests_cache-1.2.1}/docs/_static/file-pickle.png +0 -0
  60. {requests_cache-1.2.0 → requests_cache-1.2.1}/docs/_static/file-pickle_32px.png +0 -0
  61. {requests_cache-1.2.0 → requests_cache-1.2.1}/docs/_static/file-toml.png +0 -0
  62. {requests_cache-1.2.0 → requests_cache-1.2.1}/docs/_static/file-toml_32px.png +0 -0
  63. {requests_cache-1.2.0 → requests_cache-1.2.1}/docs/_static/file-yaml.png +0 -0
  64. {requests_cache-1.2.0 → requests_cache-1.2.1}/docs/_static/file-yaml_32px.png +0 -0
  65. {requests_cache-1.2.0 → requests_cache-1.2.1}/docs/_static/file-yaml_32px.png.png +0 -0
  66. {requests_cache-1.2.0 → requests_cache-1.2.1}/docs/_static/files-generic.png +0 -0
  67. {requests_cache-1.2.0 → requests_cache-1.2.1}/docs/_static/files-generic_32px.png +0 -0
  68. {requests_cache-1.2.0 → requests_cache-1.2.1}/docs/_static/files-json.png +0 -0
  69. {requests_cache-1.2.0 → requests_cache-1.2.1}/docs/_static/files-json_32px.png +0 -0
  70. {requests_cache-1.2.0 → requests_cache-1.2.1}/docs/_static/memcached.png +0 -0
  71. {requests_cache-1.2.0 → requests_cache-1.2.1}/docs/_static/memcached_32px.png +0 -0
  72. {requests_cache-1.2.0 → requests_cache-1.2.1}/docs/_static/memory_32px.png +0 -0
  73. {requests_cache-1.2.0 → requests_cache-1.2.1}/docs/_static/mongodb.png +0 -0
  74. {requests_cache-1.2.0 → requests_cache-1.2.1}/docs/_static/mongodb_32px.png +0 -0
  75. {requests_cache-1.2.0 → requests_cache-1.2.1}/docs/_static/mongodb_vscode.png +0 -0
  76. {requests_cache-1.2.0 → requests_cache-1.2.1}/docs/_static/redis.png +0 -0
  77. {requests_cache-1.2.0 → requests_cache-1.2.1}/docs/_static/redis_32px.png +0 -0
  78. {requests_cache-1.2.0 → requests_cache-1.2.1}/docs/_static/requests-cache-gh-preview.png +0 -0
  79. {requests_cache-1.2.0 → requests_cache-1.2.1}/docs/_static/requests-cache-icon.png +0 -0
  80. {requests_cache-1.2.0 → requests_cache-1.2.1}/docs/_static/requests-cache-logo-dark.webp +0 -0
  81. {requests_cache-1.2.0 → requests_cache-1.2.1}/docs/_static/requests-cache-logo-header.png +0 -0
  82. {requests_cache-1.2.0 → requests_cache-1.2.1}/docs/_static/requests-cache-logo-light.webp +0 -0
  83. {requests_cache-1.2.0 → requests_cache-1.2.1}/docs/_static/sqlite.png +0 -0
  84. {requests_cache-1.2.0 → requests_cache-1.2.1}/docs/_static/sqlite_32px.png +0 -0
  85. {requests_cache-1.2.0 → requests_cache-1.2.1}/docs/_static/table.css +0 -0
  86. {requests_cache-1.2.0 → requests_cache-1.2.1}/docs/_static/toml.png +0 -0
  87. {requests_cache-1.2.0 → requests_cache-1.2.1}/docs/_templates/module.rst_t +0 -0
  88. {requests_cache-1.2.0 → requests_cache-1.2.1}/docs/_templates/package.rst_t +0 -0
  89. {requests_cache-1.2.0 → requests_cache-1.2.1}/docs/api/requests_cache.session.md +0 -0
  90. {requests_cache-1.2.0 → requests_cache-1.2.1}/docs/docker-compose.yml +0 -0
  91. {requests_cache-1.2.0 → requests_cache-1.2.1}/docs/examples.md +0 -0
  92. {requests_cache-1.2.0 → requests_cache-1.2.1}/docs/index.md +0 -0
  93. {requests_cache-1.2.0 → requests_cache-1.2.1}/docs/project_info/code_of_conduct.md +0 -0
  94. {requests_cache-1.2.0 → requests_cache-1.2.1}/docs/project_info/codeshelter.md +0 -0
  95. {requests_cache-1.2.0 → requests_cache-1.2.1}/docs/project_info/contributing.md +0 -0
  96. {requests_cache-1.2.0 → requests_cache-1.2.1}/docs/project_info/contributors.md +0 -0
  97. {requests_cache-1.2.0 → requests_cache-1.2.1}/docs/project_info/history.md +0 -0
  98. {requests_cache-1.2.0 → requests_cache-1.2.1}/docs/project_info/related_projects.md +0 -0
  99. {requests_cache-1.2.0 → requests_cache-1.2.1}/docs/project_info.md +0 -0
  100. {requests_cache-1.2.0 → requests_cache-1.2.1}/docs/reference.md +0 -0
  101. {requests_cache-1.2.0 → requests_cache-1.2.1}/docs/sample_data/sample_response_binary.json +0 -0
  102. {requests_cache-1.2.0 → requests_cache-1.2.1}/docs/sample_data/sample_response_binary.yaml +0 -0
  103. {requests_cache-1.2.0 → requests_cache-1.2.1}/docs/sample_data/sample_response_json.json +0 -0
  104. {requests_cache-1.2.0 → requests_cache-1.2.1}/docs/sample_data/sample_response_json.yaml +0 -0
  105. {requests_cache-1.2.0 → requests_cache-1.2.1}/docs/user_guide/advanced_requests.md +0 -0
  106. {requests_cache-1.2.0 → requests_cache-1.2.1}/docs/user_guide/backends/dynamodb.md +0 -0
  107. {requests_cache-1.2.0 → requests_cache-1.2.1}/docs/user_guide/backends/filesystem.md +0 -0
  108. {requests_cache-1.2.0 → requests_cache-1.2.1}/docs/user_guide/backends/gridfs.md +0 -0
  109. {requests_cache-1.2.0 → requests_cache-1.2.1}/docs/user_guide/backends/mongodb.md +0 -0
  110. {requests_cache-1.2.0 → requests_cache-1.2.1}/docs/user_guide/backends/redis.md +0 -0
  111. {requests_cache-1.2.0 → requests_cache-1.2.1}/docs/user_guide/backends/sqlite.md +0 -0
  112. {requests_cache-1.2.0 → requests_cache-1.2.1}/docs/user_guide/backends.md +0 -0
  113. {requests_cache-1.2.0 → requests_cache-1.2.1}/docs/user_guide/compatibility.md +0 -0
  114. {requests_cache-1.2.0 → requests_cache-1.2.1}/docs/user_guide/files.md +0 -0
  115. {requests_cache-1.2.0 → requests_cache-1.2.1}/docs/user_guide/filtering.md +0 -0
  116. {requests_cache-1.2.0 → requests_cache-1.2.1}/docs/user_guide/headers.md +0 -0
  117. {requests_cache-1.2.0 → requests_cache-1.2.1}/docs/user_guide/inspection.md +0 -0
  118. {requests_cache-1.2.0 → requests_cache-1.2.1}/docs/user_guide/installation.md +0 -0
  119. {requests_cache-1.2.0 → requests_cache-1.2.1}/docs/user_guide/security.md +0 -0
  120. {requests_cache-1.2.0 → requests_cache-1.2.1}/docs/user_guide/serializers.md +0 -0
  121. {requests_cache-1.2.0 → requests_cache-1.2.1}/docs/user_guide.md +0 -0
  122. {requests_cache-1.2.0 → requests_cache-1.2.1}/docs/vector/requests-cache-logo-header.svg +0 -0
  123. {requests_cache-1.2.0 → requests_cache-1.2.1}/docs/vector/requests-cache-logo.svg +0 -0
  124. {requests_cache-1.2.0 → requests_cache-1.2.1}/docs/vector/requests_cache_icon.svg +0 -0
  125. {requests_cache-1.2.0 → requests_cache-1.2.1}/examples/README.md +0 -0
  126. {requests_cache-1.2.0 → requests_cache-1.2.1}/examples/basic_patching.py +0 -0
  127. {requests_cache-1.2.0 → requests_cache-1.2.1}/examples/basic_sessions.py +0 -0
  128. {requests_cache-1.2.0 → requests_cache-1.2.1}/examples/benchmark.py +0 -0
  129. {requests_cache-1.2.0 → requests_cache-1.2.1}/examples/cloudformation.yml +0 -0
  130. {requests_cache-1.2.0 → requests_cache-1.2.1}/examples/convert_cache.py +0 -0
  131. {requests_cache-1.2.0 → requests_cache-1.2.1}/examples/custom_request_matcher.py +0 -0
  132. {requests_cache-1.2.0 → requests_cache-1.2.1}/examples/expiration.py +0 -0
  133. {requests_cache-1.2.0 → requests_cache-1.2.1}/examples/external_config.py +0 -0
  134. {requests_cache-1.2.0 → requests_cache-1.2.1}/examples/external_config.yml +0 -0
  135. {requests_cache-1.2.0 → requests_cache-1.2.1}/examples/generate_test_db.py +0 -0
  136. {requests_cache-1.2.0 → requests_cache-1.2.1}/examples/github_actions.yml +0 -0
  137. {requests_cache-1.2.0 → requests_cache-1.2.1}/examples/log_requests.py +0 -0
  138. {requests_cache-1.2.0 → requests_cache-1.2.1}/examples/pygithub.py +0 -0
  139. {requests_cache-1.2.0 → requests_cache-1.2.1}/examples/rps_graph.png +0 -0
  140. {requests_cache-1.2.0 → requests_cache-1.2.1}/examples/rps_graph.py +0 -0
  141. {requests_cache-1.2.0 → requests_cache-1.2.1}/examples/threads.py +0 -0
  142. {requests_cache-1.2.0 → requests_cache-1.2.1}/examples/time_machine_backtesting.py +0 -0
  143. {requests_cache-1.2.0 → requests_cache-1.2.1}/examples/url_patterns.py +0 -0
  144. {requests_cache-1.2.0 → requests_cache-1.2.1}/examples/vcr.py +0 -0
  145. {requests_cache-1.2.0 → requests_cache-1.2.1}/requests_cache/models/base.py +0 -0
  146. {requests_cache-1.2.0 → requests_cache-1.2.1}/requests_cache/models/raw_response.py +0 -0
  147. {requests_cache-1.2.0 → requests_cache-1.2.1}/requests_cache/models/request.py +0 -0
  148. {requests_cache-1.2.0 → requests_cache-1.2.1}/requests_cache/policy/actions.py +0 -0
  149. {requests_cache-1.2.0 → requests_cache-1.2.1}/requests_cache/policy/directives.py +0 -0
  150. {requests_cache-1.2.0 → requests_cache-1.2.1}/requests_cache/policy/settings.py +0 -0
  151. {requests_cache-1.2.0 → requests_cache-1.2.1}/requests_cache/py.typed +0 -0
  152. {requests_cache-1.2.0 → requests_cache-1.2.1}/tests/README.md +0 -0
  153. {requests_cache-1.2.0 → requests_cache-1.2.1}/tests/__init__.py +0 -0
  154. {requests_cache-1.2.0 → requests_cache-1.2.1}/tests/compat/README.md +0 -0
  155. {requests_cache-1.2.0 → requests_cache-1.2.1}/tests/integration/__init__.py +0 -0
  156. {requests_cache-1.2.0 → requests_cache-1.2.1}/tests/integration/test_dynamodb.py +0 -0
  157. {requests_cache-1.2.0 → requests_cache-1.2.1}/tests/integration/test_filesystem.py +0 -0
  158. {requests_cache-1.2.0 → requests_cache-1.2.1}/tests/integration/test_memory.py +0 -0
  159. {requests_cache-1.2.0 → requests_cache-1.2.1}/tests/integration/test_mongodb.py +0 -0
  160. {requests_cache-1.2.0 → requests_cache-1.2.1}/tests/integration/test_redis.py +0 -0
  161. {requests_cache-1.2.0 → requests_cache-1.2.1}/tests/integration/test_sqlite.py +0 -0
  162. {requests_cache-1.2.0 → requests_cache-1.2.1}/tests/integration/test_upgrade.py +0 -0
  163. {requests_cache-1.2.0 → requests_cache-1.2.1}/tests/sample_data/sample.db.0.3.0 +0 -0
  164. {requests_cache-1.2.0 → requests_cache-1.2.1}/tests/sample_data/sample.db.0.4.0 +0 -0
  165. {requests_cache-1.2.0 → requests_cache-1.2.1}/tests/sample_data/sample.db.0.4.13 +0 -0
  166. {requests_cache-1.2.0 → requests_cache-1.2.1}/tests/sample_data/sample.db.0.5.0 +0 -0
  167. {requests_cache-1.2.0 → requests_cache-1.2.1}/tests/sample_data/sample.db.0.5.1 +0 -0
  168. {requests_cache-1.2.0 → requests_cache-1.2.1}/tests/sample_data/sample.db.0.5.2 +0 -0
  169. {requests_cache-1.2.0 → requests_cache-1.2.1}/tests/sample_data/sample.db.0.6.0 +0 -0
  170. {requests_cache-1.2.0 → requests_cache-1.2.1}/tests/sample_data/sample.db.0.6.1 +0 -0
  171. {requests_cache-1.2.0 → requests_cache-1.2.1}/tests/sample_data/sample.db.0.6.2 +0 -0
  172. {requests_cache-1.2.0 → requests_cache-1.2.1}/tests/sample_data/sample.db.0.6.3 +0 -0
  173. {requests_cache-1.2.0 → requests_cache-1.2.1}/tests/sample_data/sample.db.0.6.4 +0 -0
  174. {requests_cache-1.2.0 → requests_cache-1.2.1}/tests/sample_data/sample.db.0.7.0 +0 -0
  175. {requests_cache-1.2.0 → requests_cache-1.2.1}/tests/sample_data/sample.db.0.7.1 +0 -0
  176. {requests_cache-1.2.0 → requests_cache-1.2.1}/tests/sample_data/sample.db.0.7.2 +0 -0
  177. {requests_cache-1.2.0 → requests_cache-1.2.1}/tests/sample_data/sample.db.0.7.3 +0 -0
  178. {requests_cache-1.2.0 → requests_cache-1.2.1}/tests/sample_data/sample.db.0.7.4 +0 -0
  179. {requests_cache-1.2.0 → requests_cache-1.2.1}/tests/sample_data/sample.db.0.7.5 +0 -0
  180. {requests_cache-1.2.0 → requests_cache-1.2.1}/tests/sample_data/sample.db.0.8.0 +0 -0
  181. {requests_cache-1.2.0 → requests_cache-1.2.1}/tests/sample_data/sample.db.0.8.1 +0 -0
  182. {requests_cache-1.2.0 → requests_cache-1.2.1}/tests/sample_data/sample.db.0.9.0 +0 -0
  183. {requests_cache-1.2.0 → requests_cache-1.2.1}/tests/sample_data/sample.db.0.9.1 +0 -0
  184. {requests_cache-1.2.0 → requests_cache-1.2.1}/tests/sample_data/sample.db.0.9.2 +0 -0
  185. {requests_cache-1.2.0 → requests_cache-1.2.1}/tests/sample_data/sample.db.0.9.3 +0 -0
  186. {requests_cache-1.2.0 → requests_cache-1.2.1}/tests/sample_data/sample.db.0.9.4 +0 -0
  187. {requests_cache-1.2.0 → requests_cache-1.2.1}/tests/sample_data/sample.db.0.9.5 +0 -0
  188. {requests_cache-1.2.0 → requests_cache-1.2.1}/tests/sample_data/sample.db.0.9.6 +0 -0
  189. {requests_cache-1.2.0 → requests_cache-1.2.1}/tests/sample_data/sample.db.0.9.7 +0 -0
  190. {requests_cache-1.2.0 → requests_cache-1.2.1}/tests/sample_data/sample.db.0.9.8 +0 -0
  191. {requests_cache-1.2.0 → requests_cache-1.2.1}/tests/sample_data/sample.db.1.0.0 +0 -0
  192. {requests_cache-1.2.0 → requests_cache-1.2.1}/tests/sample_data/sample.db.1.1.0 +0 -0
  193. {requests_cache-1.2.0 → requests_cache-1.2.1}/tests/sample_data/sample.db.1.2.0 +0 -0
  194. {requests_cache-1.2.0 → requests_cache-1.2.1}/tests/sample_data/vcr_requests_cache.yaml +0 -0
  195. {requests_cache-1.2.0 → requests_cache-1.2.1}/tests/sample_data/vcr_vcrpy.yaml +0 -0
  196. {requests_cache-1.2.0 → requests_cache-1.2.1}/tests/unit/models/test_base.py +0 -0
  197. {requests_cache-1.2.0 → requests_cache-1.2.1}/tests/unit/models/test_raw_response.py +0 -0
  198. {requests_cache-1.2.0 → requests_cache-1.2.1}/tests/unit/models/test_request.py +0 -0
  199. {requests_cache-1.2.0 → requests_cache-1.2.1}/tests/unit/models/test_response.py +0 -0
  200. {requests_cache-1.2.0 → requests_cache-1.2.1}/tests/unit/policy/test_actions.py +0 -0
  201. {requests_cache-1.2.0 → requests_cache-1.2.1}/tests/unit/policy/test_expiration.py +0 -0
  202. {requests_cache-1.2.0 → requests_cache-1.2.1}/tests/unit/test_patcher.py +0 -0
  203. {requests_cache-1.2.0 → requests_cache-1.2.1}/tests/unit/test_serializers.py +0 -0
@@ -11,7 +11,7 @@ contributions that have helped to improve requests-cache:
11
11
  <tbody>
12
12
  <tr>
13
13
  <td align="center" valign="top" width="14.28%"><a href="https://github.com/amangean"><img src="https://avatars.githubusercontent.com/u/3106815?v=4?s=100" width="100px;" alt="A. Mangean"/><br /><sub><b>A. Mangean</b></sub></a><br /><a href="https://github.com/requests-cache/requests-cache/issues?q=author%3Aamangean" title="Bug reports">🐛</a></td>
14
- <td align="center" valign="top" width="14.28%"><a href="https://meltano.com/"><img src="https://avatars.githubusercontent.com/u/18150651?v=4?s=100" width="100px;" alt="Aaron (&quot;AJ&quot;) Steers"/><br /><sub><b>Aaron (&quot;AJ&quot;) Steers</b></sub></a><br /><a href="#ideas-aaronsteers" title="Ideas, Planning, & Feedback">🤔</a></td>
14
+ <td align="center" valign="top" width="14.28%"><a href="https://meltano.com/"><img src="https://avatars.githubusercontent.com/u/18150651?v=4?s=100" width="100px;" alt="Aaron ("AJ") Steers"/><br /><sub><b>Aaron ("AJ") Steers</b></sub></a><br /><a href="#ideas-aaronsteers" title="Ideas, Planning, & Feedback">🤔</a></td>
15
15
  <td align="center" valign="top" width="14.28%"><a href="http://aljohri.com/"><img src="https://avatars.githubusercontent.com/u/2790092?v=4?s=100" width="100px;" alt="Al Johri"/><br /><sub><b>Al Johri</b></sub></a><br /><a href="#ideas-AlJohri" title="Ideas, Planning, & Feedback">🤔</a></td>
16
16
  <td align="center" valign="top" width="14.28%"><a href="https://github.com/olk-m"><img src="https://avatars.githubusercontent.com/u/148966056?v=4?s=100" width="100px;" alt="Alessio"/><br /><sub><b>Alessio</b></sub></a><br /><a href="https://github.com/requests-cache/requests-cache/issues?q=author%3Aolk-m" title="Bug reports">🐛</a> <a href="https://github.com/requests-cache/requests-cache/commits?author=olk-m" title="Code">💻</a></td>
17
17
  <td align="center" valign="top" width="14.28%"><a href="http://grep.ro/"><img src="https://avatars.githubusercontent.com/u/27617?v=4?s=100" width="100px;" alt="Alex Morega"/><br /><sub><b>Alex Morega</b></sub></a><br /><a href="https://github.com/requests-cache/requests-cache/commits?author=mgax" title="Documentation">📖</a> <a href="https://github.com/requests-cache/requests-cache/issues?q=author%3Amgax" title="Bug reports">🐛</a></td>
@@ -115,27 +115,29 @@ contributions that have helped to improve requests-cache:
115
115
  <td align="center" valign="top" width="14.28%"><a href="https://github.com/TheTechromancer"><img src="https://avatars.githubusercontent.com/u/20261699?v=4?s=100" width="100px;" alt="TheTechromancer"/><br /><sub><b>TheTechromancer</b></sub></a><br /><a href="https://github.com/requests-cache/requests-cache/issues?q=author%3ATheTechromancer" title="Bug reports">🐛</a></td>
116
116
  <td align="center" valign="top" width="14.28%"><a href="https://netomi.github.io/"><img src="https://avatars.githubusercontent.com/u/1048055?v=4?s=100" width="100px;" alt="Thomas Neidhart"/><br /><sub><b>Thomas Neidhart</b></sub></a><br /><a href="https://github.com/requests-cache/requests-cache/issues?q=author%3Anetomi" title="Bug reports">🐛</a> <a href="https://github.com/requests-cache/requests-cache/commits?author=netomi" title="Code">💻</a></td>
117
117
  <td align="center" valign="top" width="14.28%"><a href="https://github.com/ValueRaider"><img src="https://avatars.githubusercontent.com/u/96923577?v=4?s=100" width="100px;" alt="ValueRaider"/><br /><sub><b>ValueRaider</b></sub></a><br /><a href="https://github.com/requests-cache/requests-cache/commits?author=ValueRaider" title="Documentation">📖</a></td>
118
- <td align="center" valign="top" width="14.28%"><a href="https://vladimir.panteleev.md/"><img src="https://avatars.githubusercontent.com/u/160894?v=4?s=100" width="100px;" alt="Vladimir Panteleev"/><br /><sub><b>Vladimir Panteleev</b></sub></a><br /><a href="#ideas-CyberShadow" title="Ideas, Planning, & Feedback">🤔</a></td>
118
+ <td align="center" valign="top" width="14.28%"><a href="https://www.thedataschool.com.au/the-team/vincent-ging-ho-yim/"><img src="https://avatars.githubusercontent.com/u/28189684?v=4?s=100" width="100px;" alt="Vincent Ging Ho Yim"/><br /><sub><b>Vincent Ging Ho Yim</b></sub></a><br /><a href="https://github.com/requests-cache/requests-cache/issues?q=author%3Acenviity" title="Bug reports">🐛</a> <a href="https://github.com/requests-cache/requests-cache/commits?author=cenviity" title="Code">💻</a></td>
119
119
  </tr>
120
120
  <tr>
121
+ <td align="center" valign="top" width="14.28%"><a href="https://vladimir.panteleev.md/"><img src="https://avatars.githubusercontent.com/u/160894?v=4?s=100" width="100px;" alt="Vladimir Panteleev"/><br /><sub><b>Vladimir Panteleev</b></sub></a><br /><a href="#ideas-CyberShadow" title="Ideas, Planning, & Feedback">🤔</a></td>
121
122
  <td align="center" valign="top" width="14.28%"><a href="https://sansec.io/"><img src="https://avatars.githubusercontent.com/u/1145479?v=4?s=100" width="100px;" alt="Willem de Groot"/><br /><sub><b>Willem de Groot</b></sub></a><br /><a href="https://github.com/requests-cache/requests-cache/commits?author=gwillem" title="Code">💻</a> <a href="https://github.com/requests-cache/requests-cache/issues?q=author%3Agwillem" title="Bug reports">🐛</a></td>
122
123
  <td align="center" valign="top" width="14.28%"><a href="https://github.com/WouterVH"><img src="https://avatars.githubusercontent.com/u/469509?v=4?s=100" width="100px;" alt="Wouter Vanden Hove"/><br /><sub><b>Wouter Vanden Hove</b></sub></a><br /><a href="https://github.com/requests-cache/requests-cache/issues?q=author%3AWouterVH" title="Bug reports">🐛</a></td>
123
124
  <td align="center" valign="top" width="14.28%"><a href="https://github.com/YetAnotherNerd"><img src="https://avatars.githubusercontent.com/u/320738?v=4?s=100" width="100px;" alt="YetAnotherNerd"/><br /><sub><b>YetAnotherNerd</b></sub></a><br /><a href="https://github.com/requests-cache/requests-cache/commits?author=YetAnotherNerd" title="Code">💻</a> <a href="#feature-YetAnotherNerd" title="New features">✨</a> <a href="https://github.com/requests-cache/requests-cache/issues?q=author%3AYetAnotherNerd" title="Bug reports">🐛</a></td>
124
125
  <td align="center" valign="top" width="14.28%"><a href="https://github.com/aaron-mf1"><img src="https://avatars.githubusercontent.com/u/65560918?v=4?s=100" width="100px;" alt="aaron-mf1"/><br /><sub><b>aaron-mf1</b></sub></a><br /><a href="#ideas-aaron-mf1" title="Ideas, Planning, & Feedback">🤔</a></td>
125
126
  <td align="center" valign="top" width="14.28%"><a href="https://github.com/coryairbhb"><img src="https://avatars.githubusercontent.com/u/50755629?v=4?s=100" width="100px;" alt="coryairbhb"/><br /><sub><b>coryairbhb</b></sub></a><br /><a href="https://github.com/requests-cache/requests-cache/issues?q=author%3Acoryairbhb" title="Bug reports">🐛</a></td>
126
127
  <td align="center" valign="top" width="14.28%"><a href="https://github.com/craigls"><img src="https://avatars.githubusercontent.com/u/972350?v=4?s=100" width="100px;" alt="craig"/><br /><sub><b>craig</b></sub></a><br /><a href="https://github.com/requests-cache/requests-cache/commits?author=craigls" title="Code">💻</a> <a href="https://github.com/requests-cache/requests-cache/issues?q=author%3Acraigls" title="Bug reports">🐛</a></td>
127
- <td align="center" valign="top" width="14.28%"><a href="https://denes.omnipathdb.org/"><img src="https://avatars.githubusercontent.com/u/2679889?v=4?s=100" width="100px;" alt="deeenes"/><br /><sub><b>deeenes</b></sub></a><br /><a href="https://github.com/requests-cache/requests-cache/issues?q=author%3Adeeenes" title="Bug reports">🐛</a></td>
128
128
  </tr>
129
129
  <tr>
130
+ <td align="center" valign="top" width="14.28%"><a href="https://denes.omnipathdb.org/"><img src="https://avatars.githubusercontent.com/u/2679889?v=4?s=100" width="100px;" alt="deeenes"/><br /><sub><b>deeenes</b></sub></a><br /><a href="https://github.com/requests-cache/requests-cache/issues?q=author%3Adeeenes" title="Bug reports">🐛</a></td>
130
131
  <td align="center" valign="top" width="14.28%"><a href="https://stackoverflow.com/users/86643/denis"><img src="https://avatars.githubusercontent.com/u/1280390?v=4?s=100" width="100px;" alt="denis-bz"/><br /><sub><b>denis-bz</b></sub></a><br /><a href="https://github.com/requests-cache/requests-cache/issues?q=author%3Adenis-bz" title="Bug reports">🐛</a></td>
131
132
  <td align="center" valign="top" width="14.28%"><a href="https://github.com/eserdk"><img src="https://avatars.githubusercontent.com/u/16106844?v=4?s=100" width="100px;" alt="eserdk"/><br /><sub><b>eserdk</b></sub></a><br /><a href="#ideas-eserdk" title="Ideas, Planning, & Feedback">🤔</a></td>
132
133
  <td align="center" valign="top" width="14.28%"><a href="https://gir.st/"><img src="https://avatars.githubusercontent.com/u/11820748?v=4?s=100" width="100px;" alt="girst"/><br /><sub><b>girst</b></sub></a><br /><a href="https://github.com/requests-cache/requests-cache/issues?q=author%3Agirst" title="Bug reports">🐛</a></td>
133
134
  <td align="center" valign="top" width="14.28%"><a href="https://github.com/gorogoroumaru"><img src="https://avatars.githubusercontent.com/u/30716350?v=4?s=100" width="100px;" alt="gorogoroumaru"/><br /><sub><b>gorogoroumaru</b></sub></a><br /><a href="https://github.com/requests-cache/requests-cache/commits?author=gorogoroumaru" title="Code">💻</a></td>
134
135
  <td align="center" valign="top" width="14.28%"><a href="https://github.com/gsalvatella"><img src="https://avatars.githubusercontent.com/u/42438361?v=4?s=100" width="100px;" alt="gsalvatella "/><br /><sub><b>gsalvatella </b></sub></a><br /><a href="https://github.com/requests-cache/requests-cache/issues?q=author%3Agsalvatella" title="Bug reports">🐛</a></td>
135
136
  <td align="center" valign="top" width="14.28%"><a href="https://github.com/harvey251"><img src="https://avatars.githubusercontent.com/u/33844174?v=4?s=100" width="100px;" alt="harvey251"/><br /><sub><b>harvey251</b></sub></a><br /><a href="https://github.com/requests-cache/requests-cache/issues?q=author%3Aharvey251" title="Bug reports">🐛</a></td>
136
- <td align="center" valign="top" width="14.28%"><a href="https://github.com/masavini"><img src="https://avatars.githubusercontent.com/u/6315187?v=4?s=100" width="100px;" alt="masavini"/><br /><sub><b>masavini</b></sub></a><br /><a href="https://github.com/requests-cache/requests-cache/commits?author=masavini" title="Documentation">📖</a></td>
137
137
  </tr>
138
138
  <tr>
139
+ <td align="center" valign="top" width="14.28%"><a href="https://github.com/jcd000"><img src="https://avatars.githubusercontent.com/u/8661795?v=4?s=100" width="100px;" alt="jcd000"/><br /><sub><b>jcd000</b></sub></a><br /><a href="https://github.com/requests-cache/requests-cache/issues?q=author%3Ajcd000" title="Bug reports">🐛</a> <a href="https://github.com/requests-cache/requests-cache/commits?author=jcd000" title="Code">💻</a></td>
140
+ <td align="center" valign="top" width="14.28%"><a href="https://github.com/masavini"><img src="https://avatars.githubusercontent.com/u/6315187?v=4?s=100" width="100px;" alt="masavini"/><br /><sub><b>masavini</b></sub></a><br /><a href="https://github.com/requests-cache/requests-cache/commits?author=masavini" title="Documentation">📖</a></td>
139
141
  <td align="center" valign="top" width="14.28%"><a href="https://github.com/mbarkhau"><img src="https://avatars.githubusercontent.com/u/446561?v=4?s=100" width="100px;" alt="mbarkhau"/><br /><sub><b>mbarkhau</b></sub></a><br /><a href="https://github.com/requests-cache/requests-cache/commits?author=mbarkhau" title="Code">💻</a> <a href="https://github.com/requests-cache/requests-cache/commits?author=mbarkhau" title="Tests">⚠️</a> <a href="#infra-mbarkhau" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a> <a href="https://github.com/requests-cache/requests-cache/issues?q=author%3Ambarkhau" title="Bug reports">🐛</a></td>
140
142
  <td align="center" valign="top" width="14.28%"><a href="https://github.com/shiftinv"><img src="https://avatars.githubusercontent.com/u/8530778?v=4?s=100" width="100px;" alt="shiftinv"/><br /><sub><b>shiftinv</b></sub></a><br /><a href="https://github.com/requests-cache/requests-cache/commits?author=shiftinv" title="Code">💻</a> <a href="https://github.com/requests-cache/requests-cache/issues?q=author%3Ashiftinv" title="Bug reports">🐛</a></td>
141
143
  <td align="center" valign="top" width="14.28%"><a href="https://www.witionstheme.com/"><img src="https://avatars.githubusercontent.com/u/55755139?v=4?s=100" width="100px;" alt="witionstheme"/><br /><sub><b>witionstheme</b></sub></a><br /><a href="https://github.com/requests-cache/requests-cache/issues?q=author%3Awitionstheme" title="Bug reports">🐛</a></td>
@@ -1,5 +1,14 @@
1
1
  # History
2
2
 
3
+ ## Unreleased
4
+
5
+ 🪲 **Bugfixes:**
6
+ * Fix `normalize_headers` not accepting header values in bytes
7
+ * Fix inconsistency due to rounding in `CachedResponse.expires_unix` property
8
+ * Fix form boundary used for cached multipart requests to _fully_ comply with RFC 2046
9
+ * Fix loading cached JSON content with `decode_content=True` when the root element is an empty list or object
10
+ * Fix usage example with `responses` library to be compatible with `requests` 2.32
11
+
3
12
  ## 1.2.0 (2024-02-17)
4
13
 
5
14
  ⚠️ **Deprecations & removals:**
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: requests-cache
3
- Version: 1.2.0
3
+ Version: 1.2.1
4
4
  Summary: A persistent cache for python requests
5
5
  Home-page: https://github.com/requests-cache/requests-cache
6
6
  License: BSD-2-Clause
@@ -9,6 +9,7 @@ Notes:
9
9
  * The `api/` directory contains manually formatted sources for some modules
10
10
  * The `_templates` directory contains some Sphinx templates that modify auto-generated sources
11
11
  """
12
+
12
13
  import os
13
14
  import sys
14
15
  from os.path import join
@@ -86,7 +86,7 @@ Examples:
86
86
  ```
87
87
 
88
88
  **Notes:**
89
- - `urls_expire_after` should be a dict in the format `{pattern': expire_after}`
89
+ - `urls_expire_after` should be a dict in the format `{pattern: expire_after}`
90
90
  - `expire_after` accepts the same types as `CachedSession.settings.expire_after`
91
91
  - **Glob patterns** will match request **base URLs without the protocol**, so the pattern `site.com/resource/`
92
92
  is equivalent to `http*://site.com/resource/**`.
@@ -140,7 +140,7 @@ expiration will only apply to new responses (including refreshes of expired resp
140
140
  Options to apply a new expiration value include:
141
141
  * Clearing the cache
142
142
  * {ref}`Refreshing <refresh>` individual requests
143
- * Use :py:meth:`.BaseCache.reset_expiration`:
143
+ * Use {py:meth}`.BaseCache.reset_expiration`:
144
144
  ```python
145
145
  # Reset expiration for all responses to 30 days from now
146
146
  >>> session.cache.reset_expiration(timedelta(days=30))
@@ -100,7 +100,7 @@ There are a number of settings that affect cache behavior, which are covered in
100
100
 
101
101
  These can all be passed as keyword arguments to {py:class}`.CachedSession` or
102
102
  {py:func}`.install_cache`. When using a session object, these can also be safely modified at any
103
- time via {py:attr}`.CachedSession.settings`. For example:
103
+ time via {py:class}`CachedSession.settings <.CacheSettings>`. For example:
104
104
  ```python
105
105
  >>> from requests_cache import CachedSession
106
106
 
@@ -121,7 +121,7 @@ session = CachedSession(key_fn=create_key)
121
121
  ```
122
122
 
123
123
  `**kwargs` includes relevant {py:class}`.BaseCache` settings and any other keyword args passed to
124
- {py:meth}`.CachedSession.send()`. If you want use a custom matching function _and_ the existing
124
+ {py:meth}`.CachedSession.send`. If you want use a custom matching function _and_ the existing
125
125
  options `ignored_parameters` and `match_headers`, you can implement them in `key_fn`:
126
126
  ```python
127
127
  def create_key(
@@ -67,7 +67,7 @@ Here are some error messages you may see either in the logs or (more rarely) in
67
67
  usually means that a response was previously cached in a format that isn't compatible with the
68
68
  current version of requests-cache or one of its dependencies.
69
69
  * This message is to help with debugging and can generally be ignored. If you prefer, you can
70
- either {py:meth}`~.BaseCache.remove` the invalid responses or {py:meth}`~.BaseCache.clear` the
70
+ either {py:meth}`~.BaseCache.delete` the invalid responses or {py:meth}`~.BaseCache.clear` the
71
71
  entire cache.
72
72
  * **`Request for URL {url} failed; using cached response`:** This is just a notification that the
73
73
  {ref}`stale_if_error <request-errors>` option is working as intended.
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "requests-cache"
3
- version = "1.2.0"
3
+ version = "1.2.1"
4
4
  description = "A persistent cache for python requests"
5
5
  authors = ["Roman Haritonov", "Jordan Cook"]
6
6
  license = "BSD-2-Clause"
@@ -126,7 +126,7 @@ pytest-clarity = "^1.0.1"
126
126
  pytest-cov = ">=3.0"
127
127
  pytest-rerunfailures = ">=10.1"
128
128
  pytest-xdist = ">=2.2"
129
- requests-mock = "^1.9"
129
+ requests-mock = "^1.12"
130
130
  responses = ">=0.19"
131
131
  tenacity = "^8.0"
132
132
  timeout-decorator = "^0.5"
@@ -186,14 +186,16 @@ fix = true
186
186
  unsafe-fixes = true
187
187
  line-length = 100
188
188
  output-format = 'grouped'
189
- select = ['B', 'C4', 'C90', 'E', 'F']
190
- ignore = ['B023']
191
189
  target-version = 'py38'
192
190
  exclude = ['examples/']
193
191
 
194
192
  [tool.ruff.format]
195
193
  quote-style = 'single'
196
194
 
195
+ [tool.ruff.lint]
196
+ select = ['B', 'C4', 'C90', 'E', 'F']
197
+ ignore = ['B023']
198
+
197
199
  [tool.ruff.lint.isort]
198
200
  known-first-party = ['tests']
199
201
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  # Version is defined in pyproject.toml.
4
4
  # It's copied here to make it easier for client code to check the installed version.
5
- __version__ = '1.2.0'
5
+ __version__ = '1.2.1'
6
6
 
7
7
  from .backends import *
8
8
  from .cache_keys import *
@@ -1,4 +1,5 @@
1
1
  """Minor internal utility functions that don't really belong anywhere else"""
2
+
2
3
  from contextlib import contextmanager
3
4
  from inspect import signature
4
5
  from logging import getLogger
@@ -6,7 +7,7 @@ from typing import Any, Callable, Dict, Iterable, Iterator, List, Optional, Tupl
6
7
 
7
8
  from urllib3 import filepost
8
9
 
9
- FORM_BOUNDARY = '==requests-cache-form-boundary=='
10
+ FORM_BOUNDARY = '--requests-cache-form-boundary--'
10
11
 
11
12
  KwargDict = Dict[str, Any]
12
13
  logger = getLogger('requests_cache')
@@ -1,4 +1,5 @@
1
1
  """Classes and functions for cache persistence. See :ref:`backends` for general usage info."""
2
+
2
3
  # ruff: noqa: F401
3
4
  from logging import getLogger
4
5
  from pathlib import Path
@@ -4,6 +4,7 @@
4
4
  :classes-only:
5
5
  :nosignatures:
6
6
  """
7
+
7
8
  from __future__ import annotations
8
9
 
9
10
  from abc import ABC
@@ -4,6 +4,7 @@
4
4
  :classes-only:
5
5
  :nosignatures:
6
6
  """
7
+
7
8
  from typing import Iterable, Optional
8
9
 
9
10
  import boto3
@@ -4,6 +4,7 @@
4
4
  :classes-only:
5
5
  :nosignatures:
6
6
  """
7
+
7
8
  from contextlib import contextmanager
8
9
  from os import makedirs
9
10
  from pathlib import Path
@@ -4,6 +4,7 @@
4
4
  :classes-only:
5
5
  :nosignatures:
6
6
  """
7
+
7
8
  from logging import getLogger
8
9
  from threading import RLock
9
10
  from typing import Optional
@@ -25,8 +26,8 @@ class GridFSCache(BaseCache):
25
26
 
26
27
  Args:
27
28
  db_name: Database name
28
- connection: :py:class:`pymongo.MongoClient` object to reuse instead of creating a new one
29
- kwargs: Additional keyword arguments for :py:class:`pymongo.MongoClient`
29
+ connection: :py:class:`~pymongo.mongo_client.MongoClient` object to reuse instead of creating a new one
30
+ kwargs: Additional keyword arguments for :py:class:`~pymongo.mongo_client.MongoClient`
30
31
  """
31
32
 
32
33
  def __init__(
@@ -59,8 +60,8 @@ class GridFSDict(BaseStorage):
59
60
  Args:
60
61
  db_name: Database name
61
62
  collection_name: Ignored; GridFS internally uses collections 'fs.files' and 'fs.chunks'
62
- connection: :py:class:`pymongo.MongoClient` object to reuse instead of creating a new one
63
- kwargs: Additional keyword arguments for :py:class:`pymongo.MongoClient`
63
+ connection: :py:class:`~pymongo.mongo_client.MongoClient` object to reuse instead of creating a new one
64
+ kwargs: Additional keyword arguments for :py:class:`~pymongo.mongo_client.MongoClient`
64
65
  """
65
66
 
66
67
  def __init__(
@@ -4,6 +4,7 @@
4
4
  :classes-only:
5
5
  :nosignatures:
6
6
  """
7
+
7
8
  from datetime import timedelta
8
9
  from logging import getLogger
9
10
  from typing import Iterable, Mapping, Optional, Union
@@ -21,12 +22,12 @@ logger = getLogger(__name__)
21
22
 
22
23
  class MongoCache(BaseCache):
23
24
  """MongoDB cache backend.
24
- By default, responses are only partially serialized into a MongoDB-compatible document format.
25
+ By default, responses are partially serialized into a MongoDB-compatible document format.
25
26
 
26
27
  Args:
27
28
  db_name: Database name
28
- connection: :py:class:`pymongo.MongoClient` object to reuse instead of creating a new one
29
- kwargs: Additional keyword arguments for :py:class:`pymongo.mongo_client.MongoClient`
29
+ connection: :py:class:`~pymongo.mongo_client.MongoClient` object to reuse instead of creating a new one
30
+ kwargs: Additional keyword arguments for :py:class:`~pymongo.mongo_client.MongoClient`
30
31
  """
31
32
 
32
33
  def __init__(
@@ -75,8 +76,8 @@ class MongoDict(BaseStorage):
75
76
  Args:
76
77
  db_name: Database name
77
78
  collection_name: Collection name
78
- connection: :py:class:`pymongo.MongoClient` object to reuse instead of creating a new one
79
- kwargs: Additional keyword arguments for :py:class:`pymongo.MongoClient`
79
+ connection: :py:class:`~pymongo.mongo_client.MongoClient` object to reuse instead of creating a new one
80
+ kwargs: Additional keyword arguments for :py:class:`~pymongo.mongo_client.MongoClient`
80
81
  """
81
82
 
82
83
  def __init__(
@@ -4,6 +4,7 @@
4
4
  :classes-only:
5
5
  :nosignatures:
6
6
  """
7
+
7
8
  from logging import getLogger
8
9
  from typing import Iterable, Optional
9
10
 
@@ -4,6 +4,7 @@
4
4
  :classes-only:
5
5
  :nosignatures:
6
6
  """
7
+
7
8
  import sqlite3
8
9
  import threading
9
10
  from contextlib import contextmanager
@@ -36,7 +37,7 @@ class SQLiteCache(BaseCache):
36
37
 
37
38
  Args:
38
39
  db_path: Database file path
39
- use_cache_dir: Store datebase in a user cache directory (e.g., `~/.cache/http_cache.sqlite`)
40
+ use_cache_dir: Store database in a user cache directory (e.g., `~/.cache/http_cache.sqlite`)
40
41
  use_temp: Store database in a temp directory (e.g., ``/tmp/http_cache.sqlite``)
41
42
  use_memory: Store database in memory instead of in a file
42
43
  busy_timeout: Timeout in milliseconds for SQLite to wait if a table is locked.
@@ -84,7 +85,7 @@ class SQLiteCache(BaseCache):
84
85
  self.responses.init_db()
85
86
  self.redirects.init_db()
86
87
 
87
- # A more efficient SQLite implementation of :py:meth:`BaseCache.delete`
88
+ # A more efficient SQLite implementation of BaseCache.delete
88
89
  def delete(
89
90
  self,
90
91
  *keys: str,
@@ -152,7 +153,7 @@ class SQLiteCache(BaseCache):
152
153
  """
153
154
  return self.responses.count(expired=expired)
154
155
 
155
- # A more efficient implementation of :py:meth:`BaseCache.filter` to make use of indexes
156
+ # A more efficient implementation of BaseCache.filter to make use of indexes
156
157
  def filter(
157
158
  self,
158
159
  valid: bool = True,
@@ -167,7 +168,7 @@ class SQLiteCache(BaseCache):
167
168
  valid=valid, expired=expired, invalid=invalid, older_than=older_than
168
169
  )
169
170
 
170
- # A more efficient implementation of :py:meth:`BaseCache.recreate_keys
171
+ # A more efficient implementation of BaseCache.recreate_keys
171
172
  def recreate_keys(self):
172
173
  with self.responses.bulk_commit():
173
174
  super().recreate_keys()
@@ -4,6 +4,7 @@
4
4
  :functions-only:
5
5
  :nosignatures:
6
6
  """
7
+
7
8
  from __future__ import annotations
8
9
 
9
10
  import json
@@ -133,6 +134,7 @@ def normalize_headers(
133
134
  headers: MutableMapping[str, str], ignored_parameters: ParamList = None
134
135
  ) -> CaseInsensitiveDict:
135
136
  """Sort and filter request headers, and normalize minor variations in multi-value headers"""
137
+ headers = {k: decode(v) for (k, v) in headers.items()}
136
138
  if ignored_parameters:
137
139
  headers = filter_sort_dict(headers, ignored_parameters)
138
140
  for k, v in headers.items():
@@ -1,4 +1,5 @@
1
1
  """Data models used to serialize response data"""
2
+
2
3
  # ruff: noqa: F401
3
4
  from typing import Union
4
5
 
@@ -2,7 +2,6 @@ from __future__ import annotations
2
2
 
3
3
  from datetime import datetime, timedelta
4
4
  from logging import getLogger
5
- from time import time
6
5
  from typing import TYPE_CHECKING, Dict, List, Optional, Union
7
6
 
8
7
  import attr
@@ -144,8 +143,9 @@ class CachedResponse(RichMixin, BaseResponse):
144
143
  @property
145
144
  def expires_unix(self) -> Optional[int]:
146
145
  """Get expiration time as a Unix timestamp"""
147
- seconds = self.expires_delta
148
- return round(time() + seconds) if seconds is not None else None
146
+ if self.expires is None:
147
+ return None
148
+ return round(self.expires.timestamp())
149
149
 
150
150
  @property
151
151
  def from_cache(self) -> bool:
@@ -187,10 +187,10 @@ class CachedResponse(RichMixin, BaseResponse):
187
187
 
188
188
  def __str__(self):
189
189
  return (
190
- f'<CachedResponse [{self.status_code}]: '
191
- f'created: {format_datetime(self.created_at)}, '
190
+ f'<CachedResponse [{self.status_code}]: "'
191
+ f"created: {format_datetime(self.created_at)}, "
192
192
  f'expires: {format_datetime(self.expires)} ({"stale" if self.is_expired else "fresh"}), '
193
- f'size: {format_file_size(self.size)}, request: {self.request}>'
193
+ f"size: {format_file_size(self.size)}, request: {self.request}>"
194
194
  )
195
195
 
196
196
 
@@ -1,12 +1,14 @@
1
1
  """Utilities for patching ``requests``. See :ref:`patching` for general usage info.
2
2
 
3
- .. warning:: These functions are not thread-safe. Use :py:class:`.CachedSession` if you want to use
4
- caching in a multi-threaded environment.
3
+ .. warning::
4
+ These functions are not thread-safe. Use :py:class:`.CachedSession` if you want to use caching
5
+ in a multi-threaded environment.
5
6
 
6
7
  .. automodsumm:: requests_cache.patcher
7
8
  :functions-only:
8
9
  :nosignatures:
9
10
  """
11
+
10
12
  from contextlib import contextmanager
11
13
  from logging import getLogger
12
14
  from typing import Optional, Type
@@ -108,7 +110,7 @@ def clear():
108
110
 
109
111
  def delete(*args, **kwargs):
110
112
  """Remove responses from the cache according one or more conditions.
111
- See :py:meth:`.BaseCache.delete for usage details.
113
+ See :py:meth:`.BaseCache.delete` for usage details.
112
114
  """
113
115
  session = requests.Session()
114
116
  if isinstance(session, CachedSession):
@@ -1,6 +1,7 @@
1
1
  """Modules that implement cache policy, based on a combination of standard HTTP headers and
2
2
  additional settings and features specific to requests-cache.
3
3
  """
4
+
4
5
  # ruff: noqa: E402,F401,F403
5
6
  # isort: skip_file
6
7
  from datetime import datetime, timedelta
@@ -1,4 +1,5 @@
1
1
  """Utility functions for parsing and converting expiration values"""
2
+
2
3
  from datetime import datetime, timedelta, timezone
3
4
  from email.utils import parsedate_to_datetime
4
5
  from fnmatch import fnmatch
@@ -18,6 +18,7 @@ For example, for JSON:
18
18
  For any optional libraries that aren't installed, the corresponding serializer will be a placeholder
19
19
  class that raises an ``ImportError`` at initialization time instead of at import time.
20
20
  """
21
+
21
22
  # ruff: noqa: F401
22
23
  from typing import Optional, Union
23
24
 
@@ -11,22 +11,24 @@ serialization formats.
11
11
  :functions-only:
12
12
  :nosignatures:
13
13
  """
14
+
14
15
  from __future__ import annotations
16
+
17
+ from collections.abc import MutableMapping
15
18
  from datetime import datetime, timedelta
16
19
  from decimal import Decimal
20
+ from functools import singledispatchmethod
17
21
  from json import JSONDecodeError
18
22
  from typing import Callable, Dict, ForwardRef, List, Optional, Union
19
- from functools import singledispatchmethod
20
- from collections.abc import MutableMapping
21
23
 
22
24
  from cattrs import Converter
23
25
  from requests.cookies import RequestsCookieJar, cookiejar_from_dict
24
26
  from requests.exceptions import RequestException
25
27
  from requests.structures import CaseInsensitiveDict
26
28
 
29
+ from .._utils import is_json_content_type
27
30
  from ..models import CachedResponse, DecodedContent
28
31
  from .pipeline import Stage
29
- from .._utils import is_json_content_type
30
32
 
31
33
  try:
32
34
  import ujson as json
@@ -185,7 +187,7 @@ def _encode_content(response: CachedResponse) -> CachedResponse:
185
187
  This has no effect for a binary response body.
186
188
  """
187
189
  # The response may have previously been saved with `decode_content=False`
188
- if not response._decoded_content:
190
+ if response._decoded_content is None:
189
191
  return response
190
192
 
191
193
  # Encode body as JSON
@@ -4,6 +4,7 @@
4
4
  :classes-only:
5
5
  :nosignatures:
6
6
  """
7
+
7
8
  from typing import Any, Callable, Optional, Sequence, Union
8
9
 
9
10
  from ..models import CachedResponse
@@ -4,6 +4,7 @@
4
4
  .. automodsumm:: requests_cache.serializers.preconf
5
5
  :nosignatures:
6
6
  """
7
+
7
8
  import pickle
8
9
  from functools import partial
9
10
  from importlib import import_module
@@ -1,4 +1,5 @@
1
1
  """Main classes to add caching features to :py:class:`requests.Session`"""
2
+
2
3
  from contextlib import contextmanager, nullcontext
3
4
  from logging import getLogger
4
5
  from threading import RLock, Thread
@@ -19,6 +19,7 @@ cattrs+ujson.loads: 2.128
19
19
  cattrs+bson.dumps: 1.550
20
20
  cattrs+bson.loads: 1.322
21
21
  """
22
+
22
23
  # ruff: noqa: E402,F401,F841
23
24
  import json
24
25
  import os
@@ -1,4 +1,5 @@
1
1
  """Example of using requests-cache with the requests-mock library"""
2
+
2
3
  import pytest
3
4
  from requests_mock import Adapter
4
5
 
@@ -1,4 +1,5 @@
1
1
  """Example of using requests-cache with the requests-mock library"""
2
+
2
3
  import pytest
3
4
  import requests
4
5
 
@@ -1,4 +1,5 @@
1
1
  """Example of using requests-cache with the requests-mock library"""
2
+
2
3
  from os.path import dirname, join
3
4
  from unittest.mock import patch
4
5
 
@@ -1,4 +1,5 @@
1
1
  """Example of using requests-cache with the responses library"""
2
+
2
3
  from contextlib import contextmanager
3
4
  from os.path import dirname, join
4
5
  from unittest.mock import patch
@@ -43,7 +44,9 @@ def get_responses():
43
44
 
44
45
  # responses patches HTTPAdapter.send(), so we need to patch one level lower to verify request mocking
45
46
  @patch.object(
46
- requests.adapters.HTTPAdapter, 'get_connection', side_effect=ValueError('Real request made!')
47
+ requests.adapters.HTTPAdapter,
48
+ 'get_connection_with_tls_context',
49
+ side_effect=ValueError('Real request made!'),
47
50
  )
48
51
  def test_mock_session(mock_http_adapter):
49
52
  """Test that the mock_session fixture is working as expected"""
@@ -8,6 +8,7 @@ Note: The protocol ``http(s)+mock://`` helps :py:class:`requests_mock.Adapter` p
8
8
  :py:class:`requests.PreparedRequest`. More info here:
9
9
  https://requests-mock.readthedocs.io/en/latest/adapter.html
10
10
  """
11
+
11
12
  import os
12
13
  import platform
13
14
  import warnings
@@ -28,7 +29,13 @@ from requests_mock import Adapter
28
29
  from rich.logging import RichHandler
29
30
  from timeout_decorator import timeout
30
31
 
31
- from requests_cache import ALL_METHODS, CachedSession, install_cache, uninstall_cache, utcnow
32
+ from requests_cache import (
33
+ ALL_METHODS,
34
+ CachedSession,
35
+ install_cache,
36
+ uninstall_cache,
37
+ utcnow,
38
+ )
32
39
 
33
40
  # ignore missing time-travel library on PyPy
34
41
  try:
@@ -331,7 +338,7 @@ def skip_missing_deps(module_name: str) -> pytest.Mark:
331
338
 
332
339
  @contextmanager
333
340
  def ignore_deprecation():
334
- """Temporarily ilence deprecation warnings"""
341
+ """Temporarily silence deprecation warnings"""
335
342
  with warnings.catch_warnings():
336
343
  warnings.simplefilter('ignore', category=DeprecationWarning)
337
344
  yield