本文整理汇总了Python中models.team.Team.validate_key_name方法的典型用法代码示例。如果您正苦于以下问题:Python Team.validate_key_name方法的具体用法?Python Team.validate_key_name怎么用?Python Team.validate_key_name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.team.Team
的用法示例。
在下文中一共展示了Team.validate_key_name方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from models.team import Team [as 别名]
# 或者: from models.team.Team import validate_key_name [as 别名]
def main(key, url):
print "Configuring GAE Remote API on {} to import {}".format(url, key)
if 'localhost' in url:
remote_api_stub.ConfigureRemoteApi(None, '/_ah/remote_api', local_auth_func, url)
else:
remote_api_stub.ConfigureRemoteApiForOAuth(url, '/_ah/remote_api')
print "Loading data from The Blue Alliance requires an API key"
print "Please go to https://thebluealliance.com/account and generate a read API key"
apiv3_key = raw_input("Enter your API key: ")
global AUTH_TOKEN
AUTH_TOKEN = apiv3_key
if Match.validate_key_name(key):
match_data = fetch_match(key)
store_match(match_data)
elif Event.validate_key_name(key):
update_event(key)
elif Team.validate_key_name(key):
team_data = fetch_team(key)
store_team(team_data)
elif key.isdigit():
event_keys = [event['key'] for event in fetch_endpoint('events/{}'.format(key))]
for event in event_keys:
update_event(event)
else:
print "Unknown key :("
示例2: main
# 需要导入模块: from models.team import Team [as 别名]
# 或者: from models.team.Team import validate_key_name [as 别名]
def main(key, url):
print "Configuring GAE Remote API on {} to import {}".format(url, key)
if 'localhost' in url:
remote_api_stub.ConfigureRemoteApi(None, '/_ah/remote_api', local_auth_func, url)
else:
remote_api_stub.ConfigureRemoteApiForOAuth(url, '/_ah/remote_api')
print "Loading data from The Blue Alliance requires an API key"
print "Please go to https://thebluealliance.com/account and generate a read API key"
apiv3_key = raw_input("Enter your API key: ")
global AUTH_TOKEN
AUTH_TOKEN = apiv3_key
if Match.validate_key_name(key):
match_data = fetch_match(key)
store_match(match_data)
elif Event.validate_key_name(key):
event_data = fetch_event(key)
event = store_event(event_data)
event_teams = fetch_event_detail(key, 'teams')
teams = map(store_team, event_teams)
map(lambda t: store_eventteam(t, event), teams)
event_matches = fetch_event_detail(key, 'matches')
map(store_match, event_matches)
event_rankings = fetch_event_detail(key, 'rankings')
store_eventdetail(event, 'rankings2', event_rankings['rankings'] if event_rankings else [])
event_alliances = fetch_event_detail(key, 'alliances')
store_eventdetail(event, 'alliance_selections', event_alliances)
event_awards = fetch_event_detail(key, 'awards')
map(lambda t: store_award(t, event), event_awards)
elif Team.validate_key_name(key):
team_data = fetch_team(key)
store_team(team_data)
else:
print "Unknown key :("
示例3: test_invalid_team_key
# 需要导入模块: from models.team import Team [as 别名]
# 或者: from models.team.Team import validate_key_name [as 别名]
def test_invalid_team_key(self):
self.assertEqual(Team.validate_key_name(self.invalid_team_key), False)
self.assertEqual(Team.validate_key_name(self.invalid_team_key2), False)
self.assertEqual(Team.validate_key_name(self.invalid_team_key3), False)
示例4: test_valid_team_key
# 需要导入模块: from models.team import Team [as 别名]
# 或者: from models.team.Team import validate_key_name [as 别名]
def test_valid_team_key(self):
self.assertEqual(Team.validate_key_name(self.valid_team_key), True)
self.assertEqual(Team.validate_key_name(self.valid_team_key2), True)
示例5: is_valid_model_key
# 需要导入模块: from models.team import Team [as 别名]
# 或者: from models.team.Team import validate_key_name [as 别名]
def is_valid_model_key(cls, key):
return (Team.validate_key_name(key) or
Event.validate_key_name(key) or
Match.validate_key_name(key) or
District.validate_key_name(key))