From a0d5c793ebc2537458ecbd226b5b6d8b06b78267 Mon Sep 17 00:00:00 2001 From: j Date: Thu, 27 Jul 2023 18:21:21 +0200 Subject: [PATCH] use CaseInsensitiveDict --- ox/cache.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ox/cache.py b/ox/cache.py index b5ead82..3954ea7 100644 --- a/ox/cache.py +++ b/ox/cache.py @@ -13,6 +13,7 @@ import zlib from io import BytesIO import urllib import requests +from requests.structures import CaseInsensitiveDict from .utils import json @@ -65,7 +66,7 @@ def get_headers(url, data=None, headers=None, timeout=cache_timeout): if not url_headers: url_headers = net.get_headers(url, data, headers) store.set(url, data, -1, url_headers) - return url_headers + return CaseInsensitiveDict(url_headers) def get_json(url, data=None, headers=None, timeout=cache_timeout): return json.loads(read_url(url, data, headers, timeout).decode('utf-8')) @@ -261,6 +262,8 @@ class SQLiteCache(Cache): data = zlib.compress(data) else: compressed = 0 + if isinstance(data, str): + data = data.encode("utf-8") data = sqlite3.Binary(data) #fixme: this looks wrong