Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: a script to POST iris to registry-server #52

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
19 changes: 19 additions & 0 deletions script.py
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a script i used to POST projects C03-008/012 to the registry-server.
just wanted to put this up in case we want to build off it, but it's ok if we just toss it too.

Original file line number Diff line number Diff line change
@@ -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=}")