本文整理汇总了Python中datafeeds.datafeed_fms_api.DatafeedFMSAPI.getSyncEnabledOffseasonEvents方法的典型用法代码示例。如果您正苦于以下问题:Python DatafeedFMSAPI.getSyncEnabledOffseasonEvents方法的具体用法?Python DatafeedFMSAPI.getSyncEnabledOffseasonEvents怎么用?Python DatafeedFMSAPI.getSyncEnabledOffseasonEvents使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类datafeeds.datafeed_fms_api.DatafeedFMSAPI
的用法示例。
在下文中一共展示了DatafeedFMSAPI.getSyncEnabledOffseasonEvents方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get
# 需要导入模块: from datafeeds.datafeed_fms_api import DatafeedFMSAPI [as 别名]
# 或者: from datafeeds.datafeed_fms_api.DatafeedFMSAPI import getSyncEnabledOffseasonEvents [as 别名]
def get(self, year):
df = DatafeedFMSAPI('v2.0')
first_events, _ = df.getSyncEnabledOffseasonEvents(year)
linked_events, maybed_linked_events, new_events = \
OffseasonEventHelper.categorize_offseasons(int(year), first_events)
events_to_update = []
events_to_put = []
# for all events with a first_code linked, ensure official=True
logging.info("Found {} already linked events".format(len(linked_events)))
for tba, first in linked_events:
if tba.first_code != first.event_short or not tba.official:
tba.first_code = first.event_short
tba.official = True
events_to_put.append(tba)
events_to_update.append(tba)
# for all events that we can maybe link, also do that
logging.info("Auto-linking {} probably events".format(len(maybed_linked_events)))
for tba, first in maybed_linked_events:
tba.first_code = first.event_short
tba.official = True
events_to_put.append(tba)
events_to_update.append(tba)
logging.info("Found {} events to put".format(len(events_to_put)))
if events_to_put:
EventManipulator.createOrUpdate(events_to_put)
# Enqueue details updates for these events
logging.info("Found {} events to update".format(len(events_to_update)))
for event in events_to_update:
taskqueue.add(
queue_name='datafeed',
target='backend-tasks',
url='/backend-tasks/get/event_details/'+event.key_name,
method='GET'
)
# Event we don't have anything for... Create suggestions
logging.info("Found {} new events to link".format(len(new_events)))
SuggestionCreator.createDummyOffseasonSuggestions(new_events)