-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update Aragorn kp script to not use kp registry
- Loading branch information
1 parent
223d0a1
commit 882e2c1
Showing
2 changed files
with
16 additions
and
15 deletions.
There are no files selected for viewing
29 changes: 15 additions & 14 deletions
29
src/information_resource_registry/relation_map/aragorn_kps.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,25 @@ | ||
import asyncio | ||
import requests | ||
import json | ||
from kp_registry import Registry | ||
|
||
infores_dict = {"infores:aragorn": []} | ||
|
||
|
||
async def main(): | ||
registry = Registry() | ||
def main(): | ||
url = "https://strider.renci.org/kps" | ||
response = requests.get(url) | ||
|
||
kps = await registry.retrieve_kps() | ||
if response.status_code == 200: | ||
try: | ||
kps = response.json() | ||
|
||
for kp in kps.values(): | ||
if kp.get("maturity") == "staging": | ||
infores_dict["infores:aragorn"].append(kp.get("infores", "Unknown")) | ||
|
||
# Sort the list in alphabetical order | ||
infores_dict['infores:aragorn'].sort() | ||
infores_dict["infores:aragorn"] = kps | ||
|
||
with open('src/information_resource_registry/relation_map/data/aragorn_to_kps.json', 'w') as outfile: | ||
json.dump(infores_dict, outfile, indent=2, sort_keys=True) | ||
with open('src/information_resource_registry/relation_map/data/aragorn_to_kps.json', 'w') as outfile: | ||
json.dump(infores_dict, outfile, indent=2, sort_keys=True) | ||
except Exception as e: | ||
print(f"Failed to parse list of KPs from Aragorn: {e}") | ||
else: | ||
print(f"Failed to download list of KPs from Aragorn with status code: {response.status_code}.") | ||
|
||
if __name__ == "__main__": | ||
asyncio.run(main()) | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters