本文整理汇总了Python中wordpress_xmlrpc.WordPressPost.link方法的典型用法代码示例。如果您正苦于以下问题:Python WordPressPost.link方法的具体用法?Python WordPressPost.link怎么用?Python WordPressPost.link使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wordpress_xmlrpc.WordPressPost
的用法示例。
在下文中一共展示了WordPressPost.link方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: wordPressPost
# 需要导入模块: from wordpress_xmlrpc import WordPressPost [as 别名]
# 或者: from wordpress_xmlrpc.WordPressPost import link [as 别名]
def wordPressPost():
for i in range(38):
content = """<iframe src="//www.youtube-nocookie.com/embed/""" + urls[i] + """?rel=0" \
height="360" width="640" allowfullscreen="" frameborder="0"></iframe>"""
post = WordPressPost()
post.title = titles[i]
post.content = content
print titles[i]
print content
post.link = 'http://medtwice.com/pregnancy-by-week-week-'+str(i+4)
post.post_status = 'publish'
category = wp.call(taxonomies.GetTerm('category', 44))
post.terms.append(category)
post.id = wp.call(NewPost(post))
示例2: process_item
# 需要导入模块: from wordpress_xmlrpc import WordPressPost [as 别名]
# 或者: from wordpress_xmlrpc.WordPressPost import link [as 别名]
def process_item(self, item, spider):
wp_filename = item.filename('wp')
if os.path.exists(wp_filename):
with open(wp_filename) as fh:
post = pickle.load(fh)
fh.close()
# #
# Here one might update or fix things
if False:
post.terms_names = {
'category': [item['source_name'].title()],
'post_tag': get_place_post_tag_names(item['place'])
}
self.client.call(posts.EditPost(post.id, post))
pass
pass
pass
else:
post = WordPressPost()
post.title = item['headline']
try:
post.content = item['body']
except KeyError:
return None
try:
item['place']
except KeyError:
item['place'] = ""
post.terms_names = {
'category': [item['source_name'].title()],
'post_tag': get_place_post_tag_names(item['place'])
}
post.link = item['source_url']
post.date = item['time']
post.post_status = 'publish'
post.id = self.client.call(posts.NewPost(post))
with open(wp_filename, 'wb') as fh:
pickle.dump(post, fh)
fh.close()
pass
return item
pass
示例3: entry_to_wppost
# 需要导入模块: from wordpress_xmlrpc import WordPressPost [as 别名]
# 或者: from wordpress_xmlrpc.WordPressPost import link [as 别名]
def entry_to_wppost(entry, client):
post = WordPressPost()
# Convert entry values to Post value
post.user = get_author_by_display_name(entry.author, client)
post.date = entry.published_parsed
post.post_status = "draft"
post.title = entry.title
post.content = entry.content[0].value
post.excerpt = entry.summary
post.link = entry.link
# There is some given tags
if len(entry.tags):
entry.tags = [t.term for t in entry.tags]
# Add category (with the first tag)
post.terms_names = {
'category': entry.tags[0:1],
'post_tag': [],
}
# Add tags
if len(entry.tags) > 1: post.terms_names['post_tag'] = entry.tags[1:]
return post