We help IT Professionals succeed at work.
Get Started

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

adbyits
adbyits asked
on
663 Views
Last Modified: 2019-12-12
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())
Comment
Watch Question
This problem has been solved!
Unlock 1 Answer and 1 Comment.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE