Skip to content

Commit

Permalink
pass user agent to get request
Browse files Browse the repository at this point in the history
  • Loading branch information
bdilday committed Aug 30, 2024
1 parent 691dbe3 commit 4504a6a
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions pybaseball/top_prospects.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,16 @@ def top_prospects(teamName=None, playerType=None):
else:
mlbTeamId = teamid_lookup.mlb_team_id(teamName)
url = f"https://www.mlb.com/prospects/stats?teamId={mlbTeamId}"

res = requests.get(url, timeout=None).content

res = requests.get(
url,
timeout=None,
headers={
"UserAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) "
"AppleWebKit/537.36 (KHTML, like Gecko) C"
"hrome/104.0.5112.79 Safari/537.36"
},
).content
prospectList = pd.read_html(res)

if playerType == "batters":
Expand Down

0 comments on commit 4504a6a

Please sign in to comment.