diff options
| author | Jordan Cook <jordan.cook@pioneer.com> | 2021-02-25 11:46:22 -0600 |
|---|---|---|
| committer | Jordan Cook <jordan.cook@pioneer.com> | 2021-02-26 16:02:38 -0600 |
| commit | 19198fbbd1b414a0752f4f33ae78324a878e744a (patch) | |
| tree | 1777b71395b57cbc064d11bfb0634663888c109f /requests_cache/backends/base.py | |
| parent | adf5ec9bdf40c9ba0ebbe4c3310146888de430f7 (diff) | |
| download | requests-cache-19198fbbd1b414a0752f4f33ae78324a878e744a.tar.gz | |
Remove all python 2 compatibility
Diffstat (limited to 'requests_cache/backends/base.py')
| -rw-r--r-- | requests_cache/backends/base.py | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/requests_cache/backends/base.py b/requests_cache/backends/base.py index 9b942c9..a14b884 100644 --- a/requests_cache/backends/base.py +++ b/requests_cache/backends/base.py @@ -1,5 +1,4 @@ #!/usr/bin/env python -# -*- coding: utf-8 -*- """ requests_cache.backends.base ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -11,11 +10,10 @@ import hashlib from copy import copy from datetime import datetime from io import BytesIO +from urllib.parse import parse_qsl, urlencode, urlparse, urlunparse import requests -from ..compat import bytes, is_py2, parse_qsl, str, urlencode, urlparse, urlunparse - _DEFAULT_HEADERS = requests.utils.default_headers() @@ -214,7 +212,7 @@ class BaseCache(object): elif content_type == 'application/json': import json - if not is_py2 and isinstance(body, bytes): + if isinstance(body, bytes): body = str(body, "utf8") # TODO how to get body encoding? body = json.loads(body) body = filter_ignored_parameters(sorted(body.items())) @@ -260,6 +258,4 @@ class _RawStore(object): def _to_bytes(s, encoding='utf-8'): - if is_py2 or isinstance(s, bytes): - return s - return bytes(s, encoding) + return s if isinstance(s, bytes) else bytes(s, encoding) |
