File size: 743 Bytes
2a9c2fe
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import requests
import json


class Models():

    def __init__(self, api_key):
        self.api_key = api_key
        self.headers = {
            'accept': 'application/json',
            'Authorization': f'Bearer {api_key}'
        }

    url = "https://helmholtz-blablador.fz-juelich.de:8000/v1/models"

    def get_model_data(self):
        response = requests.get(url=self.url, headers=self.headers)
        response = json.loads(response.text)
        return (response["data"])

    def get_model_ids(self):
        response = requests.get(url=self.url, headers=self.headers)
        response = json.loads(response.text)

        ids = []
        for model in response["data"]:
            ids.append(model["id"])

        return (ids)