Created
May 28, 2016 23:09
-
-
Save tervay/f0134bdf4201cbd248da8c9b4501ef1e to your computer and use it in GitHub Desktop.
An example of using the python requests library, using python 3.5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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