Skip to main content

Get network

PhenoNetAbout 2 min

Introduction

This step will guide you on how to get the public and private networks for inference. The PhenoNet platform will return the parameters file_path and task_id, which serve as an identifier for inference.

Request Description

API address: https://api.phenonet.org/api/v1/openapi/models
Request method: HTTPS GET
Return format: JSON
Content-Type: multipart/form-data
Headers: {"accessID": {{STRING}}, "secretKey": {{STRING}}}

Parameter Description

parameterdata typedescriptionvaluerequired
accessIDstringaccessID is required when sending requestssee Step I: Get AI&SKTrue
secretKeystringsecretKey is required when sending requestssee Step I: Get AI&SKTrue

Response Description

{
    "code": "{{INTEGER}}",
    "msg": "{{STRING}}",
    "data": {
        // network id : network name
        "{{STRING}}": "{{STRING}}",
    }
}

Returned parameter description

parameterdata typedescription
codeintegerstate code
msgstringreference information
dataobjectreturned content
network idstringnetwork unique identification
network namestring-

Example Code

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import requests

ACCESS_ID = ''
SECRET_KEY = ''

HEADERS = {
    "accessID": ACCESS_ID,
    "secretKey": SECRET_KEY
}

def get_network(headers):
    url = "https://api.phenonet.org/api/v1/openapi/models/"
    try:
        response = requests.get(url, headers=headers)
        response.raise_for_status()
        return response.json()
    except requests.exceptions.RequestException as e:
        print(f"Error get networks: {e}")
        return None

if __name__ == '__main__':
    network_res = get_network(HEADERS)
    if network_res:
        print(network_res)

Error Code

codedescription
403AI (Access ID) or SK (Secret Key) error
Contributors: PhenoNet