Link to home
Start Free TrialLog in
Avatar of adbyits
adbyits

asked on

Python AttributeError: 'list' object has no attribute 'find_all'

Hi all i am new to the site i am trying to get a python script i am doing working and i am getting a error AttributeError: 'list' object has no attribute 'find_all'

I have attached the code , i would like to get all the different fulds in to different elements so i can save them to a mysql database

#erth Airpirt DEPARTURE IMPORT SCRIPT
#CREATED BY ADBY IT AND MEDIA SOLUTIONS
#VERSION 1.1
#DATE 25 NOVEMBER 2019
#UPDATED 26 NOVEMBER 2019
#AUTHOR ADAM R WOLARCZUK


from requests_html import HTMLSession # import HTMLSession from requests_html
import requests
from requests_html import HTMLSession
from bs4 import BeautifulSoup
import mysql.connector


session = HTMLSession() # create an HTML Session object
resp = session.get("https://www.adelaideairport.com.au/flight-information/flight-search/") # Use the object above to connect to needed webpage
resp.html.render() # Run JavaScript code on webpage


#page = requests.get("https://www.adelaideairport.com.au/flight-information/flight-search/")
soup = BeautifulSoup(resp.html.html, "lxml")
flights = resp.html.find("SearchResultFlightListTable")
flight_items = flights.find_all(class_="row")
flight = flight_items[0]
print(flight.prettify())
ASKER CERTIFIED SOLUTION
Avatar of sahil Chopra
sahil Chopra

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial