title: Web scraping using beautiful soup (sports data)
body: <p>When i try loading this code i get two errors.
  1:The first one is that i can't properly scrape the data for name_text.</p>
  
  <p>2: I get an indentation error for team = name_text.div.text. I know it is probably easy to solve but i have tried different indentations and nothing seems to be working.</p>
  
  <p>in the website I am wanting to scrape the team name and the odds.</p>
  
  <pre><code>&lt;div class="size14_f7opyze Endeavour_fhudrb0 medium_f1wf24vo participantText_fivg86r" data-automation-id="participant-one"&gt;Orlando Magic&lt;/div&gt;
  &lt;div class="priceText_f71sibe"&gt;&lt;span class="size14_f7opyze medium_f1wf24vo priceTextSize_frw9zm9" data-automation-id="price-text"&gt;5.85&lt;/span&gt;&lt;/div&gt;
  </code></pre>
  
  <p>The html above has been copied from the site.</p>
  
  <pre><code>from bs4 import BeautifulSoup
  from urllib.request import urlopen as uReq
  my_url = 'https://www.sportsbet.com.au/betting/basketball-us'
  uClient = uReq(my_url)
  page_html = uClient.read()
  uClient.close()
  
  soup = BeautifulSoup(page_html, "html.parser")
  
  price_text = soup.findAll("div",{"class":"priceText_f71sibe"})
  name_text = soup.findAll("div",{"class":"size14_f7opyze Endeavour_fhudrb0 medium_f1wf24vo participantText_fivg86r"})
  filename = "odds.csv"
  f = open(filename,"w")
  headers = "Team, odds_team\n"
  print(name_text)
  f.write(headers)
  
  for price_text in price_texts:
  team = name_text.div.text
  odds = price_text.span.text
  
  print(odds)
  print(team + odds)
  f.write(team + "," + odds + "\n")
  f.close()
  </code></pre>
  
  <p>Any help would be great. Cheers.</p>