当前位置: 首页>>代码示例>>Python>>正文


Python WordPressPost.ping_status方法代码示例

本文整理汇总了Python中wordpress_xmlrpc.WordPressPost.ping_status方法的典型用法代码示例。如果您正苦于以下问题:Python WordPressPost.ping_status方法的具体用法?Python WordPressPost.ping_status怎么用?Python WordPressPost.ping_status使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在wordpress_xmlrpc.WordPressPost的用法示例。


在下文中一共展示了WordPressPost.ping_status方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _create_wp_post

# 需要导入模块: from wordpress_xmlrpc import WordPressPost [as 别名]
# 或者: from wordpress_xmlrpc.WordPressPost import ping_status [as 别名]
def _create_wp_post(song, content):
    # Create the NewPost object - see docs at
    # http://python-wordpress-xmlrpc.readthedocs.io/en/latest/ref/wordpress.html
    # We're missing some fields but ehhhh who knows if they even exist anymore
    post = WordPressPost()
    post.title = str(song)
    post.content = content
    post.comment_status = 'open'
    post.ping_status = 'closed'
    post.post_status = 'publish'
    post.post_type = 'post'
    post.excerpt = song.tagline
    post.date = datetime.now(tz=timezone.utc)
    post.date_modified = datetime.now(tz=timezone.utc)

    return NewPost(post)
开发者ID:katstevens,项目名称:jukebox-tnj,代码行数:18,代码来源:views.py

示例2: publish

# 需要导入模块: from wordpress_xmlrpc import WordPressPost [as 别名]
# 或者: from wordpress_xmlrpc.WordPressPost import ping_status [as 别名]
def publish(pic, title, content):
    '''
    publish a post and set to open to comment and ping(trackback)
    '''
    attachment = upload(pic)
    wp_client = Client(rpc_service_url, user, password)
    post = WordPressPost()
    post.title = title
    post.content = "%s\n\n<a href='%s'><img class='alignnone size-full wp-image-%s' alt='%s' src='%s' /></a>" % (content, attachment['url'], attachment['id'], attachment['file'], attachment['url'])
    #post.tags='test, test2'
    #post.categories=['pet','picture']
    post.thumbnail = attachment['id']
    #change status to publish
    post.id = wp_client.call(posts.NewPost(post))
    post.post_status = 'publish'
    post.comment_status = 'open'
    post.ping_status = 'open'
    post.user = account_ids[r.randint(0, len(account_ids)-1)]
    wp_client.call(posts.EditPost(post.id, post))
    return post.id
开发者ID:ZHTonyZhang,项目名称:52woo,代码行数:22,代码来源:publish.py

示例3: str

# 需要导入模块: from wordpress_xmlrpc import WordPressPost [as 别名]
# 或者: from wordpress_xmlrpc.WordPressPost import ping_status [as 别名]
				# substitute picture placeholders in content with WP loaded URL
				if response['url'] is not None:
					parsed_url = urlparse.urlparse(response['url'])
					html_img='<a href=' + response['url'] + ' target=_blank><img class=aligncenter src=' + response['url'] + ' /></a>'
					content = content.replace('[IMG' + str(filecount) + ']', html_img)
			else:
				print "DBG File '" + filename +"' cannot be found."
				sys.exit(1)

	# assemble post object (as draft first)
	new_post = WordPressPost()
	new_post.status = 'draft'
	new_post.title = title
	new_post.content = content
	new_post.comment_status = 'open'
	new_post.ping_status = 'open'

	if post_date is not None and len(post_date.strip()) > 0:
		 #new_post.date = dateutil.parser.parse(post_date + " " + datetime.now(tzlocal()).tzname())
		new_post.date = dateutil.parser.parse(post_date)

	# categorise post
	if categories is not None and len(categories.strip()) > 0:
		for category in categories.split(','):
			category_objects = wordpress.call(taxonomies.GetTerms('category', {'search': category, 'orderby': 'count', 'number': 1}))
			if category_objects != None:
				for category_object in category_objects:
					new_post.terms.append(category_object)

	# dump out post object
	#pp = pprint.PrettyPrinter(indent=1,width=80,depth=3)
开发者ID:ohingardail,项目名称:huginn-whitleypump,代码行数:33,代码来源:wp_new_post.py


注:本文中的wordpress_xmlrpc.WordPressPost.ping_status方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。