Skip to content

Commit

Permalink
bugfix: user-agent python-requests (#8394)
Browse files Browse the repository at this point in the history
  • Loading branch information
mtricolici98 authored Sep 11, 2023
1 parent 144951f commit a8987e3
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/poetry/utils/authenticator.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@

from cachecontrol import CacheControlAdapter
from cachecontrol.caches import FileCache
from requests_toolbelt import user_agent

from poetry.__version__ import __version__
from poetry.config.config import Config
from poetry.exceptions import PoetryException
from poetry.utils.constants import REQUESTS_TIMEOUT
Expand Down Expand Up @@ -134,9 +136,11 @@ def __init__(
self._get_repository_config_for_url
)
self._pool_size = pool_size
self._user_agent = user_agent("poetry", __version__)

def create_session(self) -> requests.Session:
session = requests.Session()
session.headers["User-Agent"] = self._user_agent

if self._cache_control is None:
return session
Expand Down

0 comments on commit a8987e3

Please sign in to comment.