From 637b2d27bbb5224fe2dc574a7beb302164c96b5a Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Wed, 1 Sep 2021 03:15:20 -0400 Subject: [PATCH] fix working with newer requests-cache versions Just inline the simple internal symbols that were being imported from requests-cache (since it no longer exports them). Fixes #94. --- setup.py | 2 +- tvdb_api.py | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 4d792d7..606b258 100644 --- a/setup.py +++ b/setup.py @@ -23,7 +23,7 @@ long_description_content_type='text/markdown', py_modules=['tvdb_api'], - install_requires=['requests_cache<0.6.0', 'requests'], + install_requires=['requests_cache', 'requests'], classifiers=[ "Intended Audience :: Developers", diff --git a/tvdb_api.py b/tvdb_api.py index 860fd4f..5d16e32 100644 --- a/tvdb_api.py +++ b/tvdb_api.py @@ -31,7 +31,11 @@ import requests import requests_cache -from requests_cache.backends.base import _to_bytes, _DEFAULT_HEADERS + +_DEFAULT_HEADERS = requests.utils.default_headers() + +def _to_bytes(s, encoding='utf-8'): + return s if isinstance(s, bytes) else bytes(s, encoding) IS_PY2 = sys.version_info[0] == 2