diff --git a/vespa/application.py b/vespa/application.py index 1e19e71b..0edd2b49 100644 --- a/vespa/application.py +++ b/vespa/application.py @@ -1027,6 +1027,7 @@ def _open_http_session(self): return self.http_session = Session() + self.http_session.headers.update({"User-Agent": "pyvespa syncio client"}) self.http_session.mount("https://", self.adapter) self.http_session.mount("http://", self.adapter) if self.app.vespa_cloud_secret_token: @@ -1271,7 +1272,10 @@ def __init__( self.connections = connections self.total_timeout = total_timeout if self.app.vespa_cloud_secret_token: - self.headers = {"Authorization": f"Bearer {self.app.vespa_cloud_secret_token}"} + self.headers = { + "Authorization": f"Bearer {self.app.vespa_cloud_secret_token}", + "User-Agent": "pyvespa asyncio client", + } async def __aenter__(self): await self._open_aiohttp_session() @@ -1296,7 +1300,8 @@ async def _open_aiohttp_session(self): ) else: self.aiohttp_session = aiohttp.ClientSession( - connector=conn, timeout=aiohttp.ClientTimeout(total=self.total_timeout) + connector=conn, timeout=aiohttp.ClientTimeout(total=self.total_timeout), + headers={"User-Agent": "pyvespa asyncio client"} ) return self.aiohttp_session diff --git a/vespa/test_integration_vespa_cloud_vector_search.py b/vespa/test_integration_vespa_cloud_vector_search.py index d1722766..cbc98602 100644 --- a/vespa/test_integration_vespa_cloud_vector_search.py +++ b/vespa/test_integration_vespa_cloud_vector_search.py @@ -151,6 +151,7 @@ def tearDown(self) -> None: self.app.delete_all_docs( content_cluster_name="vector_content", schema="vector",namespace="benchmark" ) + time.sleep(5) with self.app.syncio() as sync_session: response:VespaResponse = sync_session.query( {