chg: Improve logging for errors in cookies, bump har2tree

pull/746/head
Raphaël Vinot 2023-07-27 12:43:52 +02:00
parent 5fa71dc35a
commit db639d9dde
3 changed files with 9 additions and 9 deletions

View File

@ -158,15 +158,15 @@ def load_cookies(cookie_pseudofile: Optional[Union[BufferedIOBase, str, bytes, L
if isinstance(cookie_pseudofile, (str, bytes)):
try:
cookies = json.loads(cookie_pseudofile)
except json.decoder.JSONDecodeError:
logger.warning(f'Unable to load json content: {cookie_pseudofile!r}')
except json.decoder.JSONDecodeError as e:
logger.warning(f'Unable to load json content ({e}): {cookie_pseudofile!r}')
return []
elif isinstance(cookie_pseudofile, BufferedIOBase):
# Note: we might have an empty BytesIO, which is not False.
try:
cookies = json.load(cookie_pseudofile)
except json.decoder.JSONDecodeError:
logger.warning(f'Unable to load json content: {cookie_pseudofile}')
except json.decoder.JSONDecodeError as e:
logger.warning(f'Unable to load json content ({e}): {cookie_pseudofile.read()!r}')
return []
else:
# Already a dict

8
poetry.lock generated
View File

@ -908,13 +908,13 @@ tornado = ["tornado (>=0.2)"]
[[package]]
name = "har2tree"
version = "1.21.3"
version = "1.21.4"
description = "HTTP Archive (HAR) to ETE Toolkit generator"
optional = false
python-versions = ">=3.8,<3.12"
files = [
{file = "har2tree-1.21.3-py3-none-any.whl", hash = "sha256:663d78ea2409fcc1b8f0b387154ecefb11d69aa3b6bd7cd71b9efc0754a718b6"},
{file = "har2tree-1.21.3.tar.gz", hash = "sha256:6e7b03b639b33700c85d470a23cb864071be362d4dda132a78475bd05de23aae"},
{file = "har2tree-1.21.4-py3-none-any.whl", hash = "sha256:3f26b06b8e52f811cef35bac02a3266c8ce1354e4674353f884ecb2c01ec56a9"},
{file = "har2tree-1.21.4.tar.gz", hash = "sha256:c2941315f24a7c207bf79acd1c2da52b57dce31c4685d34cb63b5ce2fbabdcda"},
]
[package.dependencies]
@ -3146,4 +3146,4 @@ testing = ["big-O", "jaraco.functools", "jaraco.itertools", "more-itertools", "p
[metadata]
lock-version = "2.0"
python-versions = ">=3.8,<3.12"
content-hash = "141ce8afa6057e50da08f5960b8abdca79ff3a509dc937bdbf8f0ea89cc1f76e"
content-hash = "005fd2ad7533d8f017f529ffd2b8844a7c41b40d7f63e8ce599a42595c59375f"

View File

@ -60,7 +60,7 @@ pyhashlookup = "^1.2.1"
lief = "^0.13.2"
ua-parser = "^0.18.0"
Flask-Login = "^0.6.2"
har2tree = "^1.21.3"
har2tree = "^1.21.4"
passivetotal = "^2.5.9"
werkzeug = "^2.3.6"
filetype = "^1.2.0"