Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Give ourselves a bit more information to understand HTTP errors #184

Merged
merged 1 commit into from
Nov 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions nomenklatura/enrich/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import json
import logging
import time
import traceback
from banal import as_bool
from typing import Union, Any, Dict, Optional, Generator, Generic
from abc import ABC, abstractmethod
Expand Down Expand Up @@ -109,6 +110,7 @@ def http_get_cached(
if rex.response is not None and rex.response.status_code in (401, 403):
raise EnrichmentAbort("Authorization failure: %s" % url) from rex
msg = "HTTP fetch failed [%s]: %s" % (url, rex)
log.info(f"{msg}\n{traceback.format_exc()}")
raise EnrichmentException(msg) from rex
response = resp.text
if cache_days_ > 0:
Expand Down Expand Up @@ -164,6 +166,7 @@ def http_post_json_cached(
"Rate limit exceeded and out of retries: %s" % url
) from rex
msg = "HTTP POST failed [%s]: %s" % (url, rex)
log.info(f"{msg}\n{traceback.format_exc()}")
raise EnrichmentException(msg) from rex
resp_data = resp.json()
if cache_days_ > 0:
Expand Down