Skip to content

Commit 6a8a871

Browse files
authored
Just print server warning without hardcoded client-side addition (#3592)
1 parent 2261b8e commit 6a8a871

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

src/huggingface_hub/utils/_http.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -776,7 +776,7 @@ def _warn_on_warning_headers(response: httpx.Response) -> None:
776776
message = message.strip()
777777
if message:
778778
_WARNED_TOPICS.add(topic)
779-
logger.warning("WARNING: %s", message)
779+
logger.warning(message)
780780

781781

782782
def _format(error_type: type[HfHubHTTPError], custom_message: str, response: httpx.Response) -> HfHubHTTPError:

tests/test_utils_http.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -583,11 +583,11 @@ def test_warn_on_warning_headers(self, caplog):
583583

584584
assert _WARNED_TOPICS == {"Topic1", "Topic2", ""}
585585
warnings = [record.message for record in caplog.records if record.levelname == "WARNING"]
586-
assert "WARNING: This is the first warning message." in warnings
587-
assert "WARNING: This is the second warning message." in warnings
588-
assert "WARNING: This is a repeated warning message for Topic1." not in warnings
589-
assert "WARNING: This is a warning without a topic." in warnings
590-
assert "WARNING: This is another warning without a topic." not in warnings
586+
assert "This is the first warning message." in warnings
587+
assert "This is the second warning message." in warnings
588+
assert "This is a repeated warning message for Topic1." not in warnings
589+
assert "This is a warning without a topic." in warnings
590+
assert "This is another warning without a topic." not in warnings
591591
# Request #2 (exact same warnings, should not warn again)
592592
caplog.clear()
593593
with caplog.at_level("WARNING"):
@@ -602,5 +602,5 @@ def test_warn_on_warning_headers(self, caplog):
602602
_warn_on_warning_headers(response)
603603
warnings = [record.message for record in caplog.records if record.levelname == "WARNING"]
604604
assert len(warnings) == 1
605-
assert warnings == ["WARNING: Another warning."]
605+
assert warnings == ["Another warning."]
606606
assert "Topic4" in _WARNED_TOPICS

0 commit comments

Comments
 (0)