本文整理汇总了Python中models.Blog.select_posts_bytag方法的典型用法代码示例。如果您正苦于以下问题:Python Blog.select_posts_bytag方法的具体用法?Python Blog.select_posts_bytag怎么用?Python Blog.select_posts_bytag使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Blog
的用法示例。
在下文中一共展示了Blog.select_posts_bytag方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_get_select_posts_bytag
# 需要导入模块: from models import Blog [as 别名]
# 或者: from models.Blog import select_posts_bytag [as 别名]
def test_get_select_posts_bytag(self):
blog = Blog('tests/data/feed.xml')
selected = blog.select_posts_bytag(u'鏡館')
for p in selected:
self.assertTrue(u'鏡館' in p.tags)
示例2: get
# 需要导入模块: from models import Blog [as 别名]
# 或者: from models.Blog import select_posts_bytag [as 别名]
def get(self):
blog = Blog('http://mirahalibrary.blogspot.com/feeds/posts/default')
posts = blog.select_posts_bytag(u'鏡館')
msg = self.sample_msg(posts)
account = Account()
try:
account.tweet(msg)
except TweepError as e:
reason = 'Status is a duplicate.'
if e.response.status == 403 and e.reason == reason:
logging.info(u'retry because {0}: {1}'.format(reason, msg))
last_tweets = account.last_tweets(20)
msg = self.unduplicate_msg(last_tweets, posts)
account.tweet(msg)
else:
raise