Spaces:
Runtime error
Runtime error
File size: 520 Bytes
1c703f0 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
import requests
import json
def get_data_from_api():
# Opening the file and loading its content
with open("config.json", 'r') as file:
config = json.load(file)
response = requests.get(config["url_endpoint"])
return response.json()
def get_materials_from_api():
return get_data_from_api()['data']['compounds']
def get_properties_from_api():
return get_data_from_api()['data']['observables']
props = get_properties_from_api()
for p in props.keys():
print( props[p]['description'] ) |