Skip to content
This repository has been archived by the owner on Oct 21, 2024. It is now read-only.

Add filtering function #41

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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