Esempio n. 1
0
 def __init__(self, token):
     self.token = token
     #
     config = tbaapiv3client.Configuration()
     config.api_key["X-TBA-Auth-Key"] = self.token
     self.api = tbaapiv3client.ApiClient(config)
     #
     self.event = tbaapiv3client.EventApi(self.api)
     self.team = tbaapiv3client.TeamApi(self.api)
Esempio n. 2
0
    def create_api(self):
        config = tbaapiv3client.Configuration()

        config.api_key["X-TBA-Auth-Key"] = self.token
        config.debug = self.debug
        if self.pythonanywhere:
            config.proxy = "http://proxy.server:3128"

        self.api = ApiClientWrapper(config, self.async_req)
Esempio n. 3
0
def get_team(teamkey):
    configuration = tbaapiv3client.Configuration()
    configuration.api_key['X-TBA-Auth-Key'] = settings.THE_BLUE_ALLIANCE_KEY
    api_instance = tbaapiv3client.TeamApi(tbaapiv3client.ApiClient(configuration))
    try:
        api_response = api_instance.get_team("frc" + str(teamkey))
        info = api_response
        return info
    except ApiException as e:
        return None
Esempio n. 4
0
def get_event_matches(eventkey):
    configuration = tbaapiv3client.Configuration()
    configuration.api_key['X-TBA-Auth-Key'] = settings.THE_BLUE_ALLIANCE_KEY
    api_instance = tbaapiv3client.EventApi(
        tbaapiv3client.ApiClient(configuration))
    try:
        api_response = api_instance.get_event_matches(eventkey)
        info = api_response
        return info
    except ApiException as e:
        return None
Esempio n. 5
0
import tbaapiv3client
import requests

client_key = requests.get("https://api.retrylife.ca/auth/tba").json()["key"]

configuration = tbaapiv3client.Configuration()
configuration.api_key['X-TBA-Auth-Key'] = client_key

list_api = tbaapiv3client.ListApi(tbaapiv3client.ApiClient(configuration))
team_api = tbaapiv3client.TeamApi(tbaapiv3client.ApiClient(configuration))

def getTeamKeys(page: int):
    """Get a list of team keys in a page size of 500"""
    return list_api.get_teams_keys(page)

def readTeamGithubURL(key: str):
    global client_key

    # API issue, use requests
    response = requests.get("https://www.thebluealliance.com/api/v3/team/" + key + "/social_media", headers={"X-TBA-Auth-Key": client_key}).json()
    # response = team_api.get_team_social_media(key)

    # Check for a github account
    for media in response:
        if media["type"] == "github-profile":
            return media["foreign_key"] 
    else:
        return None