Python Forum
Sending API request with two criteria - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/Forum-Python-Coding)
+--- Forum: General Coding Help (https://python-forum.io/Forum-General-Coding-Help)
+--- Thread: Sending API request with two criteria (/Thread-Sending-API-request-with-two-criteria)



Sending API request with two criteria - hey_arnold - Feb-07-2019

Hi All,

If I run the below it won't work, however if I remove one key & value from payload it returns and answer.

How do I give payload two keys and values and get a result? Is it something to do with they json keys? I noticed that I can replace operationaldatas with meta or operationaldata, do I need to use one of these to search for the other key:values?


import requests
import pandas as pd
payload = {'pointLabel':'Isle of Grain','periodFrom':'2019-02-07T06:00:00+01:00'}
r =  requests.get('https://transparency.entsog.eu/api/v1/operationaldatas', params = payload)
website_data = r.json()['operationaldatas']
df_entsog=pd.DataFrame([[k for k in i.values()] for i in website_data],
                          columns=[i for i in website_data[0].keys()])