Skip to main content
Topic: API Py Doubt (Read 2341 times) previous topic - next topic

API Py Doubt

I'm trying to obtain information by HMDB ID using API for Python. I use the following code and it does not work, it returns empty values. The code is based on your website.

Python code:

import requests
url = "http://api.xialab.ca/mapcompounds"
payload = "{\n\t\"queryList\": \"HMDB0000002;\",\n\t\"inputType\": \"hmdb\"\n}"

headers = {
    'Content-Type': "application/json",
    'cache-control': "no-cache",
    }

response = requests.request("POST", url, data=payload, headers=headers)
print(response.text)

Thanks

Wilmer G