Files
intellecton/create_kef_osf.py
T

43 lines
1.4 KiB
Python

import urllib.request
import json
import ssl
import sys
TOKEN = "BYnPaAb6kZN7r3dz0F1rrLS1ksXwl5zoGPD4L2aS22HAosABsIMOMHqnxfO5neh0AKioVO"
BASE_URL = "https://api.osf.io/v2"
ctx = ssl.create_default_context()
ctx.check_hostname = False
ctx.verify_mode = ssl.CERT_NONE
def main():
print("Creating OSF Node for knowledge-engineering-fortress...")
payload = {
"data": {
"type": "nodes",
"attributes": {
"title": "knowledge-engineering-fortress",
"category": "project",
"description": "The central repository and vault for the knowledge engineering architecture. This OSF node serves as the academic mirror and registration point for the GitHub repository.",
"public": True
}
}
}
req = urllib.request.Request(f"{BASE_URL}/nodes/", data=json.dumps(payload).encode('utf-8'), headers={
"Authorization": f"Bearer {TOKEN}",
"Content-Type": "application/json"
}, method="POST")
try:
with urllib.request.urlopen(req, context=ctx) as response:
resp = json.loads(response.read().decode())
node_id = resp["data"]["id"]
print(f"OSF Node successfully created! Node ID: {node_id}")
print(f"URL: https://osf.io/{node_id}/")
except Exception as e:
print(f"API Error: {e}")
if __name__ == '__main__':
main()