Skip to content

Commit 1f9978d

Browse files
committed
Plain scan user-agent
1 parent 82e0e4b commit 1f9978d

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

plain-scan/plain/scan/__init__.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from importlib.metadata import version
2+
3+
__version__ = version("plain.scan")
4+
5+
__all__ = ["__version__"]

plain-scan/plain/scan/scanner.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
from requests.exceptions import ConnectionError as RequestsConnectionError
77
from requests.exceptions import SSLError
88

9+
from . import __version__
910
from .audits import (
1011
ContentTypeOptionsAudit,
1112
CookiesAudit,
@@ -52,10 +53,14 @@ def fetch(self) -> requests.Response:
5253
"""Fetch the URL and cache the response."""
5354
if self.response is None:
5455
try:
56+
user_agent = (
57+
f"plain-scan/{__version__} (+https://plainframework.com/scan)"
58+
)
5559
self.response = requests.get(
5660
self.url,
5761
allow_redirects=True,
5862
timeout=30,
63+
headers={"User-Agent": user_agent},
5964
)
6065
except (
6166
SSLError,

0 commit comments

Comments
 (0)