Skip to content

Instantly share code, notes, and snippets.

@tervay
Created May 28, 2016 23:09
Show Gist options
  • Save tervay/f0134bdf4201cbd248da8c9b4501ef1e to your computer and use it in GitHub Desktop.
Save tervay/f0134bdf4201cbd248da8c9b4501ef1e to your computer and use it in GitHub Desktop.
An example of using the python requests library, using python 3.5
import requests
__api_key = {'X-TBA-App-Id': 'ex:ex:1'}
__tba_url = 'https://www.thebluealliance.com/api/v2/'
# team_number is type int
def make_team(team_number):
url = __tba_url + 'team/frc{0}'.format(team_number)
req = requests.get(url, headers=__api_key)
response = req.json()
print(response)
# or in a compact one-liner...
def make_team2(team_number):
print(requests.get(__tba_url + 'team/frc{0}'.format(team_number), headers=__api_key).json())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment