diff options
author | Jordan Cook <jordan.cook@pioneer.com> | 2021-07-21 17:40:52 -0500 |
---|---|---|
committer | Jordan Cook <jordan.cook@pioneer.com> | 2021-07-21 17:40:52 -0500 |
commit | f66be938223ac1c0e4fb32b8d8f1d141c3fb3e87 (patch) | |
tree | 793ae085028ca2d0838ca8767bf081fa86a20aaa /docs/user_guide.md | |
parent | b2615b3609b38999ceefbd73969421b619026798 (diff) | |
download | requests-cache-f66be938223ac1c0e4fb32b8d8f1d141c3fb3e87.tar.gz |
Add doc section and sample response for YAML serializer
Diffstat (limited to 'docs/user_guide.md')
-rw-r--r-- | docs/user_guide.md | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/docs/user_guide.md b/docs/user_guide.md index 820d2c0..dc37861 100644 --- a/docs/user_guide.md +++ b/docs/user_guide.md @@ -321,9 +321,9 @@ These features require python 3.7+ and additional dependencies ::: ### JSON Serializer -Storing responses as JSON gives you the benefit of making them human-readable, in exchange for a -slight reduction in performance. This can be especially useful in combination with the filesystem -backend. +Storing responses as JSON gives you the benefit of making them human-readable and editable, in +exchange for a slight reduction in performance. This can be especially useful in combination with +the filesystem backend. :::{admonition} Example JSON-serialized Response :class: toggle @@ -337,6 +337,21 @@ You can install the extra dependencies for this serializer with: pip install requests-cache[json] ``` +### YAML Serializer +YAML is another option if you need a human-readable/editable format, with the same tradeoffs as JSON. + +:::{admonition} Example YAML-serialized Response +:class: toggle +```{literalinclude} sample_response.yaml +:language: YAML +``` +::: + +You can install the extra dependencies for this serializer with: +```bash +pip install requests-cache[yaml] +``` + ### BSON Serializer [BSON](https://www.mongodb.com/json-and-bson) is a serialization format originally created for MongoDB, but it can also be used independently. Compared to JSON, it has better performance @@ -355,6 +370,7 @@ MongoDB dependencies: pip install requests-cache[bson] ``` + ## Error Handling In some cases, you might cache a response, have it expire, but then encounter an error when retrieving a new response. If you would like to use expired response data in these cases, use the |