From 92bd30b8f8cae131e2a947acf1b79033dd09d40c Mon Sep 17 00:00:00 2001 From: Jeroen van der Heijden Date: Sun, 25 Dec 2022 21:49:29 +0100 Subject: [PATCH] headers update --- pylibagent/agent.py | 10 +++++----- pylibagent/version.py | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/pylibagent/agent.py b/pylibagent/agent.py index ce5e2cd..12c368b 100644 --- a/pylibagent/agent.py +++ b/pylibagent/agent.py @@ -66,9 +66,9 @@ def __init__(self, key: str, version: str): exit(1) self._loop: Optional[asyncio.AbstractEventLoop] = None - self._get_headers = {'Authorization': f'Bearer {token}'} + self._headers = {'Authorization': f'Bearer {token}'} self._json_headers = {'Content-Type': 'application/json'} - self._json_headers.update(self._get_headers) + self._json_headers.update(self._headers) self.asset_id: Optional[int] = None self.api_uri: str = os.getenv('API_URI', 'https://api.infrasonar.com') @@ -93,7 +93,7 @@ async def announce(self, asset_name: Optional[str] = None, return url = _join(self.api_uri, f'asset/{self.asset_id}') - async with ClientSession(headers=self._get_headers) as session: + async with ClientSession(headers=self._headers) as session: async with session.get( url, params={'field': 'name'}, @@ -235,7 +235,7 @@ async def _check_loop(self, check): async def _create_asset(self, asset_name: Optional[str] = None, asset_kind: Optional[str] = None) -> int: url = _join(self.api_uri, 'container/id') - async with ClientSession(headers=self._get_headers) as session: + async with ClientSession(headers=self._headers) as session: async with session.get(url, ssl=self.verify_ssl) as r: if r.status != 200: msg = await r.text() @@ -258,7 +258,7 @@ async def _create_asset(self, asset_name: Optional[str] = None, try: url = _join(self.api_uri, f'asset/{asset_id}/collector/{self.key}') - async with ClientSession(headers=self._json_headers) as session: + async with ClientSession(headers=self._headers) as session: async with session.post(url, ssl=self.verify_ssl) as r: if r.status != 204: msg = await r.text() diff --git a/pylibagent/version.py b/pylibagent/version.py index c3bb296..1c98a23 100644 --- a/pylibagent/version.py +++ b/pylibagent/version.py @@ -1 +1 @@ -__version__ = '0.1.8' +__version__ = '0.1.9'