use CaseInsensitiveDict
This commit is contained in:
parent
bf34774533
commit
a0d5c793eb
1 changed files with 4 additions and 1 deletions
|
@ -13,6 +13,7 @@ import zlib
|
||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
import urllib
|
import urllib
|
||||||
import requests
|
import requests
|
||||||
|
from requests.structures import CaseInsensitiveDict
|
||||||
|
|
||||||
|
|
||||||
from .utils import json
|
from .utils import json
|
||||||
|
@ -65,7 +66,7 @@ def get_headers(url, data=None, headers=None, timeout=cache_timeout):
|
||||||
if not url_headers:
|
if not url_headers:
|
||||||
url_headers = net.get_headers(url, data, headers)
|
url_headers = net.get_headers(url, data, headers)
|
||||||
store.set(url, data, -1, url_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):
|
def get_json(url, data=None, headers=None, timeout=cache_timeout):
|
||||||
return json.loads(read_url(url, data, headers, timeout).decode('utf-8'))
|
return json.loads(read_url(url, data, headers, timeout).decode('utf-8'))
|
||||||
|
@ -261,6 +262,8 @@ class SQLiteCache(Cache):
|
||||||
data = zlib.compress(data)
|
data = zlib.compress(data)
|
||||||
else:
|
else:
|
||||||
compressed = 0
|
compressed = 0
|
||||||
|
if isinstance(data, str):
|
||||||
|
data = data.encode("utf-8")
|
||||||
data = sqlite3.Binary(data)
|
data = sqlite3.Binary(data)
|
||||||
|
|
||||||
#fixme: this looks wrong
|
#fixme: this looks wrong
|
||||||
|
|
Loading…
Reference in a new issue