diff options
author | Jordan Cook <jordan.cook.git@proton.me> | 2022-10-28 11:20:46 -0500 |
---|---|---|
committer | Jordan Cook <jordan.cook.git@proton.me> | 2022-10-28 11:20:46 -0500 |
commit | 679099e733d8d7b8c70ad3a600a6eafe1524aac8 (patch) | |
tree | e78b8486daf04f69bf551d913d74b99d818ef5a4 /requests_cache | |
parent | 30fe73387e09b0d6f05f7e3f56e8cb22c6c30384 (diff) | |
download | requests-cache-679099e733d8d7b8c70ad3a600a6eafe1524aac8.tar.gz |
Handle using a converter that doesn't support the omit_if_default keyword argument
Diffstat (limited to 'requests_cache')
-rw-r--r-- | requests_cache/serializers/cattrs.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/requests_cache/serializers/cattrs.py b/requests_cache/serializers/cattrs.py index abe6458..13d05e6 100644 --- a/requests_cache/serializers/cattrs.py +++ b/requests_cache/serializers/cattrs.py @@ -81,7 +81,11 @@ def init_converter( datetime support """ factory = factory or Converter - converter = factory(omit_if_default=True) + try: + converter = factory(omit_if_default=True) + # Handle previous versions of cattrs (<22.2) that don't support this argument + except TypeError: + converter = factory() # Convert datetimes to and from iso-formatted strings if convert_datetime: |