a
This commit is contained in:
parent
e63399ea5b
commit
18400e61c2
1 changed files with 3 additions and 2 deletions
|
@ -5,6 +5,7 @@ import copy
|
||||||
|
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
|
from typing import Union
|
||||||
|
|
||||||
PseudoEtcdMeta = namedtuple("PseudoEtcdMeta", ["key"])
|
PseudoEtcdMeta = namedtuple("PseudoEtcdMeta", ["key"])
|
||||||
|
|
||||||
|
@ -23,14 +24,14 @@ class EtcdEntry:
|
||||||
print(f"Json Error: {e}, value={value}")
|
print(f"Json Error: {e}, value={value}")
|
||||||
|
|
||||||
key: str
|
key: str
|
||||||
value: str
|
value: Union[str, dict]
|
||||||
|
|
||||||
|
|
||||||
class Etcd3Wrapper(object):
|
class Etcd3Wrapper(object):
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
self.client = etcd3.client(*args, **kwargs)
|
self.client = etcd3.client(*args, **kwargs)
|
||||||
|
|
||||||
def get(self, *args, value_in_json=False, **kwargs):
|
def get(self, *args, value_in_json=False, **kwargs) -> Union[EtcdEntry, None]:
|
||||||
_value, _key = self.client.get(*args, **kwargs)
|
_value, _key = self.client.get(*args, **kwargs)
|
||||||
if _key is None or _value is None:
|
if _key is None or _value is None:
|
||||||
return None
|
return None
|
||||||
|
|
Loading…
Reference in a new issue