From c7545f82951047c02edaf633cb299fb96e0287a5 Mon Sep 17 00:00:00 2001 From: bigcat88 Date: Sun, 19 Jan 2025 17:51:57 +0200 Subject: [PATCH] set custom "User-Agent" for ExApps --- nc_py_api/_session.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/nc_py_api/_session.py b/nc_py_api/_session.py index f3750160..7d53eed8 100644 --- a/nc_py_api/_session.py +++ b/nc_py_api/_session.py @@ -12,6 +12,7 @@ from os import environ from httpx import AsyncClient, Client, Headers, Limits, ReadTimeout, Request, Response +from httpx import __version__ as httpx_version from starlette.requests import HTTPConnection from . import options @@ -511,6 +512,7 @@ def _create_adapter(self, dav: bool = False) -> AsyncClient | Client: "AA-VERSION": self.cfg.aa_version, "EX-APP-ID": self.cfg.app_name, "EX-APP-VERSION": self.cfg.app_version, + "user-agent": f"ExApp/{self.cfg.app_name}/{self.cfg.app_version} (httpx/{httpx_version})", }, ) @@ -535,6 +537,7 @@ def _create_adapter(self, dav: bool = False) -> AsyncClient | Client: "AA-VERSION": self.cfg.aa_version, "EX-APP-ID": self.cfg.app_name, "EX-APP-VERSION": self.cfg.app_version, + "User-Agent": f"ExApp/{self.cfg.app_name}/{self.cfg.app_version} (httpx/{httpx_version})", }, )