#use get request method to obtain html from the url
import requests
pga = requests.get("http://www.espn.com/golf/statistics/_/year/2019")
pga

#check to see if status code = 200
pga.status_code

#import the BeautifulSoup library to parse through the HTML
from bs4 import BeautifulSoup
page = (pga.content, 'html.parser')

#re-format the HTML to see the content better
print(page.prettify())

#earnings and player data contained in a table in the HTML file and parsed through to get the information in each row
trElements = page.find_all('tr')
for i in trElements:
    print(i.get_text())

e1c5fc5857d9e73eabb0f3976aac19d811fd455f
<mask token>

<mask token>
pga
pga.status_code
<mask token>
print(page.prettify())
<mask token>
for i in trElements:
    print(i.get_text())

<mask token>
pga = requests.get('http://www.espn.com/golf/statistics/_/year/2019')
pga
pga.status_code
<mask token>
page = pga.content, 'html.parser'
print(page.prettify())
trElements = page.find_all('tr')
for i in trElements:
    print(i.get_text())

import requests
pga = requests.get('http://www.espn.com/golf/statistics/_/year/2019')
pga
pga.status_code
from bs4 import BeautifulSoup
page = pga.content, 'html.parser'
print(page.prettify())
trElements = page.find_all('tr')
for i in trElements:
    print(i.get_text())

#use get request method to obtain html from the url
import requests
pga = requests.get("http://www.espn.com/golf/statistics/_/year/2019")
pga

#check to see if status code = 200
pga.status_code

#import the BeautifulSoup library to parse through the HTML
from bs4 import BeautifulSoup
page = (pga.content, 'html.parser')

#re-format the HTML to see the content better
print(page.prettify())

#earnings and player data contained in a table in the HTML file and parsed through to get the information in each row
trElements = page.find_all('tr')
for i in trElements:
    print(i.get_text())
