I'm trying to scrape data from multiple websites at once. At first, my code worked then a few hours ago, I started to receive error messages.
def scrape_data(team_type, url):
raw_heights = []
page = requests.get(url)
soup = BeautifulSoup(page.content, 'html.parser')
all_relevant_td_tags = soup.find_all('td', class_ = 'height' )
for height in all_relevant_td_tags:
y = height.get_text().split("-")
feet = y[0]
inches = y[1]
feet_in_inches = float(feet) * 12
inches = float(inches)
total_feet_inches = feet_in_inches + inches
raw_height.append(total_feet_in_inches)
average_height = sum(raw_heights) / len(raw_heights)
print(team_type, average_height)
This part went through but the next step:
for key, value in sports_teams.items():
scrape_data(key, value)
Started to receive error messages such as: InvalidSchema and no connection adaptors were found.