本文整理汇总了Python中datafeeds.datafeed_fms_api.DatafeedFMSAPI.getMatches方法的典型用法代码示例。如果您正苦于以下问题:Python DatafeedFMSAPI.getMatches方法的具体用法?Python DatafeedFMSAPI.getMatches怎么用?Python DatafeedFMSAPI.getMatches使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类datafeeds.datafeed_fms_api.DatafeedFMSAPI
的用法示例。
在下文中一共展示了DatafeedFMSAPI.getMatches方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get
# 需要导入模块: from datafeeds.datafeed_fms_api import DatafeedFMSAPI [as 别名]
# 或者: from datafeeds.datafeed_fms_api.DatafeedFMSAPI import getMatches [as 别名]
def get(self, event_key):
df = DatafeedFMSAPI('v2.0')
new_matches = MatchManipulator.createOrUpdate(df.getMatches(event_key))
template_values = {
'matches': new_matches,
}
path = os.path.join(os.path.dirname(__file__), '../templates/datafeeds/usfirst_matches_get.html')
self.response.out.write(template.render(path, template_values))
示例2: get
# 需要导入模块: from datafeeds.datafeed_fms_api import DatafeedFMSAPI [as 别名]
# 或者: from datafeeds.datafeed_fms_api.DatafeedFMSAPI import getMatches [as 别名]
def get(self, event_key):
df = DatafeedFMSAPI('v2.0', save_response=True)
updated_matches = []
for m1 in df.getMatches(event_key):
m2 = m1.key.get()
# Only update if teams and scores are equal
if m2 and (m1.alliances['red']['teams'] == m2.alliances['red']['teams'] and
m1.alliances['blue']['teams'] == m2.alliances['blue']['teams'] and
m1.alliances['red']['score'] == m2.alliances['red']['score'] and
m1.alliances['blue']['score'] == m2.alliances['blue']['score']):
old_alliances = m2.alliances
old_alliances['red']['dqs'] = m1.alliances['red']['dqs']
old_alliances['blue']['dqs'] = m1.alliances['blue']['dqs']
m2.alliances_json = json.dumps(old_alliances)
updated_matches.append(m2)
else:
logging.warning("Match not equal: {}".format(m1.key.id()))
MatchManipulator.createOrUpdate(updated_matches)
self.response.out.write("DONE")
示例3: get
# 需要导入模块: from datafeeds.datafeed_fms_api import DatafeedFMSAPI [as 别名]
# 或者: from datafeeds.datafeed_fms_api.DatafeedFMSAPI import getMatches [as 别名]
def get(self, event_key):
df = DatafeedFMSAPI('v2.0', save_response=True)
event = Event.get_by_id(event_key)
matches = MatchHelper.deleteInvalidMatches(
df.getMatches(event_key),
Event.get_by_id(event_key)
)
if event and event.remap_teams:
EventHelper.remapteams_matches(matches, event.remap_teams)
new_matches = MatchManipulator.createOrUpdate(matches)
template_values = {
'matches': new_matches,
}
if 'X-Appengine-Taskname' not in self.request.headers: # Only write out if not in taskqueue
path = os.path.join(os.path.dirname(__file__), '../templates/datafeeds/usfirst_matches_get.html')
self.response.out.write(template.render(path, template_values))