import urllib.request import json import ssl 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(): req = urllib.request.Request(f"{BASE_URL}/users/me/nodes/", headers={"Authorization": f"Bearer {TOKEN}"}) try: with urllib.request.urlopen(req, context=ctx) as response: data = json.loads(response.read().decode()) nodes = data.get("data", []) for n in nodes: attr = n.get("attributes", {}) title = attr.get("title") category = attr.get("category").upper() if attr.get("category") else "UNKNOWN" print(f"[{category}] {title}") desc = attr.get("description") if desc: # Print first 100 chars of description desc_clean = desc.replace("\n", " ") print(f" > {desc_clean[:120]}...") print("-" * 60) except Exception as e: print(f"Error: {e}") if __name__ == '__main__': main()