Programming: create a file baseball.py
Your task is to print all player names on the Baltimore Orioles. The code to retrieve a JSON-formatted response is already in the program. You must use the resulting data variable to pull out the player names from all of the other information in the returned JSON.
It is your task to explore the returned data, and print the names.
Required output:
Fernando Abad Jesus Aguilar Keegan Akin Logan Allen Shaun Anderson Jonathan Arauz Shawn Armstrong Bryan Baker Rylan Bannon ... ... (list continues)
Start with this program and fill it in:
import json
import requests
# Retrieves the player roster for the Baltimore Orioles (team_id=110)
r = requests.get(url="http://lookup-service-prod.mlb.com/json/named.roster_team_alltime.bam?start_season=2021&end_season=2022&team_id=110")
data = r.json()
# YOUR CODE HERE -- Print out all player names on the Orioles.
Submit your program to the online submission system under hw19-baseball
submit -c=sd211 -p=hw19-baseball baseball.py
You just have to pass one of the two tests. The player name can be accessed in two different fields which have slightly different character sets.