Python Forum
Sending API request with two criteria
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Sending API request with two criteria
#1
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()])
Reply


Messages In This Thread
Sending API request with two criteria - by hey_arnold - Feb-07-2019, 09:54 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  filtering a list of dictionary as per given criteria jss 5 597 Dec-23-2023, 08:47 AM
Last Post: Gribouillis
  how can I correct the Bad Request error on my curl request tomtom 8 4,968 Oct-03-2021, 06:32 AM
Last Post: tomtom
  ImportError: cannot import name 'Request' from 'request' abhishek81py 1 3,861 Jun-18-2020, 08:07 AM
Last Post: buran
  Read Multiples Text Files get specific lines based criteria zinho 5 3,053 May-19-2020, 12:30 PM
Last Post: zinho
  sort lists of lists with multiple criteria: similar values need to be treated equal stillsen 2 3,190 Mar-20-2019, 08:01 PM
Last Post: stillsen

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020