0

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.

001
  • 13,291
  • 5
  • 35
  • 66
Shan456
  • 3
  • 1
  • [Python Requests - No connection adapters](https://stackoverflow.com/a/15115345) – 001 Mar 10 '22 at 20:08
  • aalways put full error message (starting at word "Traceback") in question (not in comments) as text (not screenshot, not link to external portal). There are other useful information. – furas Mar 10 '22 at 20:50
  • where is `sports_teams` defined please ? – D.L Mar 10 '22 at 23:27
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Community Mar 10 '22 at 23:27

0 Answers0