本文整理汇总了Python中models.Submission.print_all方法的典型用法代码示例。如果您正苦于以下问题:Python Submission.print_all方法的具体用法?Python Submission.print_all怎么用?Python Submission.print_all使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Submission
的用法示例。
在下文中一共展示了Submission.print_all方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from models import Submission [as 别名]
# 或者: from models.Submission import print_all [as 别名]
def main() :
POST_LIMIT = 10
STREAMING_SUBS = ['mlbstreams', 'nbastreams', 'soccerstreams'] #, 'nflstreams', 'nhlstreams', 'cfbstreams', 'ncaabballstreams', 'boxingstreams', 'mmastreams']
db = DB.initialize(rebuild = False);
# Connect to Reddit
reddit_obj = Reddit.connect()
# Create submissions and comments
for sub in STREAMING_SUBS:
submissions_with_comments = Reddit.scrape_posts(reddit_obj, sub, POST_LIMIT)
Submission.create_with_comments(submissions_with_comments, db)
# Parse comments for streams
comment_data = Comment.get_all(db)
stream_list = Reddit.parse_comments_for_streams(comment_data, db)
# Create streams
for stream in stream_list:
Stream.create(stream, db)
# Print the matches table from SQLite
Submission.print_all(db)
# Close the DB connection
DB.close(db)