This commit is contained in:
ahmadbilalkhalid 2019-09-01 22:03:22 +05:00
parent e63399ea5b
commit 18400e61c2
1 changed files with 3 additions and 2 deletions

View File

@ -5,6 +5,7 @@ import copy
from collections import namedtuple
from dataclasses import dataclass
from typing import Union
PseudoEtcdMeta = namedtuple("PseudoEtcdMeta", ["key"])
@ -23,14 +24,14 @@ class EtcdEntry:
print(f"Json Error: {e}, value={value}")
key: str
value: str
value: Union[str, dict]
class Etcd3Wrapper(object):
def __init__(self, *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)
if _key is None or _value is None:
return None