mirror of
https://github.com/arcan1s/ahriman.git
synced 2025-07-13 05:55:46 +00:00
feat: extend user-agent
This commit is contained in:
@ -18,6 +18,7 @@
|
|||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#
|
#
|
||||||
import requests
|
import requests
|
||||||
|
import sys
|
||||||
|
|
||||||
from functools import cached_property
|
from functools import cached_property
|
||||||
from typing import Any, IO, Literal
|
from typing import Any, IO, Literal
|
||||||
@ -70,7 +71,10 @@ class SyncHttpClient(LazyLogging):
|
|||||||
request.Session: created session object
|
request.Session: created session object
|
||||||
"""
|
"""
|
||||||
session = requests.Session()
|
session = requests.Session()
|
||||||
session.headers["User-Agent"] = f"ahriman/{__version__}"
|
python_version = ".".join(map(str, sys.version_info[:3])) # just major.minor.patch
|
||||||
|
session.headers["User-Agent"] = f"ahriman/{__version__}" \
|
||||||
|
f"{requests.utils.default_user_agent()}" \
|
||||||
|
f"python/{python_version}"
|
||||||
|
|
||||||
return session
|
return session
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user