diff --git a/main.py b/main.py index 6079bb1..b041938 100644 --- a/main.py +++ b/main.py @@ -47,3 +47,16 @@ def print_datagram(): print(f'{key} : {value}') pprint(datagram_response) + + +def get_attribute(geo_zone, attribute_key): + with open('datagram.json', mode='r', encoding='utf-8') as json_datagram: + load_datagram: dict = json.load(json_datagram) + if geo_zone in load_datagram["pops"].keys() and attribute_key in load_datagram["pops"][geo_zone]: + print(f'geo_zone : {geo_zone}, {attribute_key} : {load_datagram["pops"][geo_zone][attribute_key]}') + return load_datagram["pops"][geo_zone][attribute_key].strip() + else: + print("Error with key value input") + return None + +