fixes for mypy and xdoctest

This commit is contained in:
Andrew Herrington
2021-12-30 23:34:23 -06:00
parent 0606e83f19
commit 86c2348172
2 changed files with 5 additions and 3 deletions

View File

@@ -8,7 +8,7 @@ Context Manager
Either the Client or AsyncClient can be used as a ContextManager (or Async Context Manager)
.. code-block:: pythong
.. code-block:: python
from healthchecks_io import AsyncClient, CheckCreate
@@ -82,6 +82,7 @@ Pinging a Check
^^^^^^^^^^^^^^^
.. code-block:: python
from healthchecks_io import Client
client = Client(api_key="myapikey")

View File

@@ -153,13 +153,14 @@ class CheckTrap:
Optional[bool]: self.suppress_exceptions, if true will not raise any exceptions
"""
if exc_type is None:
await self.client.success_ping(
# ignore typing, if we've gotten here we know its an async client
await self.client.success_ping( # type: ignore
self.uuid, self.slug, data="\n".join(self.log_lines)
)
else:
self.add_log(str(exc))
self.add_log(str(traceback))
await self.client.fail_ping(
await self.client.fail_ping( # type: ignore
self.uuid, self.slug, data="\n".join(self.log_lines)
)
return self.suppress_exceptions