diff --git a/src/hatch/index/core.py b/src/hatch/index/core.py index c5a231bae..226208bca 100644 --- a/src/hatch/index/core.py +++ b/src/hatch/index/core.py @@ -5,6 +5,8 @@ import hyperlink +from hatch._version import __version__ + if TYPE_CHECKING: import httpx @@ -47,11 +49,19 @@ def __init__(self, repo: str, *, user='', auth='', ca_cert=None, client_cert=Non @cached_property def client(self) -> httpx.Client: + import platform + import httpx from hatch.utils.network import DEFAULT_TIMEOUT + user_agent = ( + f'Hatch/{__version__} ' + f'{platform.python_implementation()}/{platform.python_version()} ' + f'HTTPX/{httpx.__version__}' + ) return httpx.Client( + headers={'User-Agent': user_agent}, transport=httpx.HTTPTransport(retries=3, verify=self.__verify, cert=self.__cert), timeout=DEFAULT_TIMEOUT, )