本文整理匯總了Python中WebCommonUtils.map_comp_to_event_code方法的典型用法代碼示例。如果您正苦於以下問題:Python WebCommonUtils.map_comp_to_event_code方法的具體用法?Python WebCommonUtils.map_comp_to_event_code怎麽用?Python WebCommonUtils.map_comp_to_event_code使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類WebCommonUtils
的用法示例。
在下文中一共展示了WebCommonUtils.map_comp_to_event_code方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: get_team_list_json_from_tba
# 需要導入模塊: import WebCommonUtils [as 別名]
# 或者: from WebCommonUtils import map_comp_to_event_code [as 別名]
def get_team_list_json_from_tba(global_config, comp):
global_config['logger'].debug( 'GET Team List For Competition From TBA %s', comp )
web.header('Content-Type', 'application/json')
result = []
result.append('{ "teams" : ')
event_code = WebCommonUtils.map_comp_to_event_code(comp)
season = WebCommonUtils.map_comp_to_season(comp)
url_str = 'http://www.thebluealliance.com/api/v2/event/%s%s/teams?X-TBA-App-Id=frc1073:scouting-system:v01' % (season,event_code)
event_data = ''
try:
event_data = urllib2.urlopen(url_str).read()
except:
event_data = '[ ]'
pass
result.append( event_data )
result.append(' }\n')
return ''.join(result)