Skip to content

Commit

Permalink
Merge pull request #2 from infrasonar/py312
Browse files Browse the repository at this point in the history
Py312
  • Loading branch information
joente authored Sep 20, 2024
2 parents f4045a1 + 194e21f commit 327d8bb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
16 changes: 8 additions & 8 deletions pylibagent/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class SendDataException(Exception):

def _convert_verify_ssl(val):
if val is None or val.lower() in ['true', '1', 'y', 'yes']:
return None # None for default SSL check
return True
return False


Expand Down Expand Up @@ -98,7 +98,7 @@ async def announce(self, asset_name: Optional[str] = None,
async with session.get(
url,
params={'fields': 'name', 'collectors': 'key'},
ssl=self.verify_ssl # type: ignore
ssl=self.verify_ssl
) as r:
if r.status != 200:
msg = await r.text()
Expand All @@ -120,7 +120,7 @@ async def announce(self, asset_name: Optional[str] = None,
async with ClientSession(headers=self._headers) as session:
async with session.post(
url,
ssl=self.verify_ssl # type: ignore
ssl=self.verify_ssl
) as r:
if r.status != 204:
msg = await r.text()
Expand Down Expand Up @@ -167,7 +167,7 @@ async def send_data(self, check_key: str, check_data: dict,
async with session.post(
url,
json=data,
ssl=self.verify_ssl # type: ignore
ssl=self.verify_ssl
) as r:
if r.status != 204:
msg = await r.text()
Expand Down Expand Up @@ -274,7 +274,7 @@ async def _create_asset(self, asset_name: Optional[str] = None,
async with ClientSession(headers=self._headers) as session:
async with session.get(
url,
ssl=self.verify_ssl # type: ignore
ssl=self.verify_ssl
) as r:
if r.status != 200:
msg = await r.text()
Expand All @@ -290,7 +290,7 @@ async def _create_asset(self, asset_name: Optional[str] = None,
async with session.post(
url,
json=data,
ssl=self.verify_ssl # type: ignore
ssl=self.verify_ssl
) as r:
if r.status != 201:
msg = await r.text()
Expand All @@ -304,7 +304,7 @@ async def _create_asset(self, asset_name: Optional[str] = None,
async with ClientSession(headers=self._headers) as session:
async with session.post(
url,
ssl=self.verify_ssl # type: ignore
ssl=self.verify_ssl
) as r:
if r.status != 204:
msg = await r.text()
Expand All @@ -322,7 +322,7 @@ async def _create_asset(self, asset_name: Optional[str] = None,
async with session.patch(
url,
json=data,
ssl=self.verify_ssl # type: ignore
ssl=self.verify_ssl
) as r:
if r.status != 204:
msg = await r.text()
Expand Down
3 changes: 2 additions & 1 deletion pylibagent/check.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ def __init_subclass__(cls, **kwargs):
raise TypeError('interval must be type int')
return super().__init_subclass__(**kwargs)

@abc.abstractclassmethod # type: ignore
@classmethod
@abc.abstractmethod
async def run(cls) -> Dict[str, List[Dict[str, Any]]]:
...

0 comments on commit 327d8bb

Please sign in to comment.