From 72f8e11148b501147358778ad4d02a4edd299400 Mon Sep 17 00:00:00 2001 From: Kyle Lawlor-Bagcal Date: Tue, 9 May 2023 17:00:54 -0400 Subject: [PATCH] feat: a script to POST iris to registry-server --- script.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100755 script.py diff --git a/script.py b/script.py new file mode 100755 index 0000000..eabb0c5 --- /dev/null +++ b/script.py @@ -0,0 +1,19 @@ +#!/usr/bin/env python +import glob +import json +import re +import requests + +files = sorted(glob.glob("ops/*/project-metadata/C03-*-project.jsonld")) +RE = re.compile("C03-([0-9]+)") + +for file in files: + if int(RE.findall(file)[0]) >= 8: + with open(file, "r") as fp: + metadata = json.load(fp) + resp = requests.post( + "https://api.registry.regen.network/iri-gen", json=metadata + ) + resp.raise_for_status() + iri = resp.json()["iri"] + print(f"{file=} {iri=}")