...
JSON is native to Python. Working with CDISC Library's JSON outputs is fairly straightforward. This code show shows how to iterate through all the hypermedia links and simply dumping out the content:
Code Block | ||||
---|---|---|---|---|
| ||||
import requests import json baseURL = "httphttps://library.cdisc.org/api" queryEndpoint = "/mdr/products" queryPath = "/Terminology" r = requests.get(baseURL + queryEndpoint + queryPath, headers={'api-key': 'abcdef0123456789abcdef0123456789', 'Accept': 'application/json'}) if r.status_code == 200: content_dict = json.loads(r.text) for package in content_dict['_links']['packages']: print("%s is a %s link for %s" % (package['href'], package['type'], package['title'])) |
...