Added context manager

This commit is contained in:
Daniil Anfimov 2022-06-24 14:50:14 +02:00
parent 3395ddc9e3
commit 69f0a5454c

View File

@ -30,6 +30,18 @@ class CasWrapper:
self._cas = local['cas'] self._cas = local['cas']
self._cas['login']() self._cas['login']()
def __enter__(self):
with local.env(
CAS_API_KEY=self._cas_api_key,
SIGNER_ID=self._cas_signer_id,
):
self._cas = local['cas']
self._cas['login']()
return self
def __exit__(self, exc_type, value, traceback):
self._cas['logout']()
def notarize( def notarize(
self, self,
local_path: str, local_path: str,