Explore Courses Blog Tutorials Interview Questions

1 Answer

0 votes
by (62.9k points)

You can pull in the json response with the query and work with that:

 import requests

from import json_normalize

base_url = ''

url = ''

headers = {

'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36',

'Accept': '*/*',

'Accept-Encoding': 'gzip, deflate, br',

'Accept-Language': 'en-US,en;q=0.9',

'Connection': 'keep-alive',

'Host': '',

'Referer': ''}

params = {

'airportCode': 'EWR',

'customDelivery': 'true',

'defaultZoomLevel': '11',

'endDate': '04/05/2019',

'endTime': '11:00',

'international': 'true',

'isMapSearch': 'false',

'itemsPerPage': '200',

'location': 'EWR',

'locationType': 'Airport',

'maximumDistanceInMiles': '30',

'sortType': 'RELEVANCE',

'startDate': '03/05/2019',

'startTime': '10:00'}

response = requests.get(url, headers=headers, params=params)

data = response.json() 

search_id = data['searchId']

print (search_id)

for ele in data['list']:

    link = ele['vehicle']['url']

    print (base_url + link) 

links_list = [ base_url + ele['vehicle']['url'] for ele in data['list'] ]

# If you want to Manipulate a table of the data

df = json_normalize(data['list'])

Welcome to Intellipaat Community. Get your technical queries answered by top developers!

29.3k questions

30.6k answers


104k users

Browse Categories