Spaces:
Runtime error
Runtime error
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'] ) |