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


Python WordPressPost.terms_names方法代码示例

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


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

示例1: post_article

# 需要导入模块: from wordpress_xmlrpc import WordPressPost [as 别名]
# 或者: from wordpress_xmlrpc.WordPressPost import terms_names [as 别名]
    def post_article(self, wordpress_link, wordpress_id, wordpress_pass, articletitle, articlecategories,
                     articlecontent, articletags, imagelink=None):
        if imagelink:
            self.path = os.getcwd() + "\\00000001.jpg"
            self.articlePhotoUrl = imagelink
            self.wpUrl = wordpress_link
            self.wpUserName = wordpress_id
            self.wpPassword = wordpress_pass
            # Download File
            f = open(self.path, 'wb')
            f.write(urllib.urlopen(self.articlePhotoUrl).read())
            f.close()
            # Upload to WordPress
            client = Client(self.wpUrl, self.wpUserName, self.wpPassword)
            filename = self.path
            # prepare metadata
            data = {
                'name': 'picture.jpg', 'type': 'image/jpg',
            }

            # read the binary file and let the XMLRPC library encode it into base64
            with open(filename, 'rb') as img:
                data['bits'] = xmlrpc_client.Binary(img.read())
            response = client.call(media.UploadFile(data))
            attachment_id = response['id']
            # Post
            post = WordPressPost()
            post.title = articletitle
            post.content = articlecontent
            post.terms_names = {'post_tag': articletags, 'category': articlecategories}
            post.post_status = 'publish'
            post.thumbnail = attachment_id
            post.id = client.call(posts.NewPost(post))
            print 'Post Successfully posted. Its Id is: ', post.id
        else:
            self.wpUrl = wordpress_link
            self.wpUserName = wordpress_id
            self.wpPassword = wordpress_pass
            # Upload to WordPress
            client = Client(self.wpUrl, self.wpUserName, self.wpPassword)
            # Post
            post = WordPressPost()
            post.title = articletitle
            post.content = articlecontent
            post.terms_names = {'post_tag': articletags, 'category': articlecategories}
            post.post_status = 'publish'
            post.id = client.call(posts.NewPost(post))
            print 'Post Successfully posted. Its Id is: ', post.id
开发者ID:KamiworksCat,项目名称:XMLRPC-wordpress-upload,代码行数:50,代码来源:wordpress_upload.py

示例2: build_game_message

# 需要导入模块: from wordpress_xmlrpc import WordPressPost [as 别名]
# 或者: from wordpress_xmlrpc.WordPressPost import terms_names [as 别名]
def build_game_message(game):
	post = WordPressPost()
	post.title = '%s - %s' % (game.name, game.brief_comment)

	converted_video_url = None
	if game.video_url is not None:
		converted_video_url = convert_youku_video_url(game.video_url)
	post.content = str(render_to_string('game_web.tpl', {
		'content' : _normalize_content(game.recommended_reason),
		'icon' : settings.MEDIA_URL + game.icon.name,
		'category' : game.category.name,
		'size' : game.size,
		'platforms' : _get_game_platforms(game),
		'id' : game.id,
		'android_download_url' : game.android_download_url,
		'iOS_download_url' : game.iOS_download_url,
		'screenshot_path_1' : settings.MEDIA_URL + game.screenshot_path_1.name,
		'screenshot_path_2' : settings.MEDIA_URL + game.screenshot_path_2.name,
		'screenshot_path_3' : settings.MEDIA_URL + game.screenshot_path_3.name,
		'screenshot_path_4' : settings.MEDIA_URL + game.screenshot_path_4.name,
		'video_url' : converted_video_url
	}))

	post.terms_names = {
		'category' : [game.category.name],
		'post_tag' : _get_game_tags(game)
	}

	if game.screenshot_path_1.name != '':
		post.custom_fields = []
		post.custom_fields.append({'key':'post_image','value':settings.MEDIA_URL + game.screenshot_path_1.name})

	post.post_status = 'publish'

	return WebMessage(game.id, post)
开发者ID:talentsun,项目名称:bestgames,代码行数:37,代码来源:web_message_builder.py

示例3: build_evaluation_message

# 需要导入模块: from wordpress_xmlrpc import WordPressPost [as 别名]
# 或者: from wordpress_xmlrpc.WordPressPost import terms_names [as 别名]
def build_evaluation_message(evaluation):
	post = WordPressPost()
	post.title = evaluation.title

	post.content = str(render_to_string('evaluation_web.tpl', {
		'id' : evaluation.id,
		'content' : _normalize_content(evaluation.recommended_reason),
		'icon' : settings.MEDIA_URL + evaluation.icon.name,
		'platforms' : _get_game_evaluation_platforms(evaluation),
		'android_download_url' : evaluation.android_download_url,
		'iOS_download_url' : evaluation.iOS_download_url,
		'evaluation_content' : evaluation.content,
		'rating' : evaluation.rating,
	}))

	post.terms_names = {
		'category' : [u'游戏测评'],
		'post_tag' : _get_game_evaluation_tags(evaluation)
	}
	if evaluation.icon.name != '':
		post.custom_fields = []
		post.custom_fields.append({'key':'post_image','value':settings.MEDIA_URL + evaluation.icon.name})

	post.post_status = 'publish'

	return WebMessage(evaluation.id, post)
开发者ID:talentsun,项目名称:bestgames,代码行数:28,代码来源:web_message_builder.py

示例4: build_collection_message

# 需要导入模块: from wordpress_xmlrpc import WordPressPost [as 别名]
# 或者: from wordpress_xmlrpc.WordPressPost import terms_names [as 别名]
def build_collection_message(collection):
	post = WordPressPost()
	post.title = collection.title

	games = []
	for game in collection.games.all():
		games.append({
			'name' : game.name,
			'brief_comment' : game.brief_comment,
			'icon' : settings.MEDIA_URL + game.icon.name,
			'category' : game.category.name,
			'size' : game.size,
			'platforms' : _get_game_platforms(game),
			'id' : game.id,
			'android_download_url' : game.android_download_url,
			'iOS_download_url' : game.iOS_download_url,
			'rating' : game.rating,
			'recommended_reason' : _normalize_content(game.recommended_reason)
			})

	post.content = str(render_to_string('collection_web.tpl', {
		'content' : _normalize_content(collection.recommended_reason),
		'cover' : settings.MEDIA_URL + collection.cover.name,
		'games' : games
	}))

	post.terms_names = {
		'category' : [u'游戏合集']
	}

	post.post_status = 'publish'

	return WebMessage(collection.id, post)
开发者ID:talentsun,项目名称:bestgames,代码行数:35,代码来源:web_message_builder.py

示例5: postToWordpress

# 需要导入模块: from wordpress_xmlrpc import WordPressPost [as 别名]
# 或者: from wordpress_xmlrpc.WordPressPost import terms_names [as 别名]
def postToWordpress(text, thisDay, wp):
    """Publishes the blog post to WordPress.
    
    Arguments:
    text -- HTML text body of the post.
    thisDay -- The date of the post, which will also become the title.
    
    Return:
    post.title -- The title of the WordPress post.
    True / False -- Whether or not the post was successfully posted.
    
    """
    post = WordPressPost()
    post.title = dateToString(thisDay)
    post.content = text
    post.date = (thisDay + 
                datetime.timedelta(0,0,0,0,30,23)) # 6:30pm, EST
    post.post_status = 'publish'
    post.terms_names = {
                        'post_tag': ['Journal Entry', 'Food'],
                        'category': ['Journal']
                        }
    try:
        wp.call(NewPost(post))
    except:
        return (post.title,False)
    return (post.title, True)
开发者ID:schlosser,项目名称:FoodJournal,代码行数:29,代码来源:WordPressPostGenerator.py

示例6: doPost

# 需要导入模块: from wordpress_xmlrpc import WordPressPost [as 别名]
# 或者: from wordpress_xmlrpc.WordPressPost import terms_names [as 别名]
 def doPost(self):
     post = WordPressPost()
     
     # get all post properties
     post.title = str(unicode(self.lnEdit_PostTitle.text()))
     post.content = str(unicode(self.txtEdit_PostContent.toPlainText()))
     tag = unicode(self.lnEditPostTags.text())
     category = unicode(self.lnEditPostCategories.text())
     # use ',' split multi-tag or category
     if ',' in tag: tag = tag.split(',')
     if ',' in category: category = category.split(',')
     post.terms_names = {
         'post_tag': tag,
         'category': category
     }
     post.post_status = str(self.cb_post_status.currentText())
     
     try:
         # new post or page-type post
         if (self._newPost_):
             post.id = self.wp.call(posts.NewPost(post))
             QtGui.QMessageBox.information(self, 'info', "Post success!", QtGui.QMessageBox.Ok)
         else:
             print 'edit...'
             # edit a post
             if self._postId_ != None:
                 self.wp.call(posts.EditPost(self._postId_, post))
                 QtGui.QMessageBox.information(self, 'info', "Edit success!", QtGui.QMessageBox.Ok)
     except Exception, e:
         QtGui.QMessageBox.information(self, 'err', str(e), QtGui.QMessageBox.Ok)
开发者ID:ifconfigyeah,项目名称:cwppm,代码行数:32,代码来源:DlgPost.py

示例7: build_news_message

# 需要导入模块: from wordpress_xmlrpc import WordPressPost [as 别名]
# 或者: from wordpress_xmlrpc.WordPressPost import terms_names [as 别名]
def build_news_message(news):
	post = WordPressPost()
	post.title = news.brief_comment

	converted_video_url = None
	if news.video_url is not None:
		converted_video_url = convert_youku_video_url(news.video_url)

	content_items = {'content' : _normalize_content(news.recommended_reason)}
	if news.screenshot_path_1:
		content_items['screenshot_path_1'] = settings.MEDIA_URL + news.screenshot_path_1.name
	if news.screenshot_path_2:
		content_items['screenshot_path_2'] = settings.MEDIA_URL + news.screenshot_path_2.name
	if news.screenshot_path_3:
		content_items['screenshot_path_3'] = settings.MEDIA_URL + news.screenshot_path_3.name
	if news.screenshot_path_4:
		content_items['screenshot_path_4'] = settings.MEDIA_URL + news.screenshot_path_4.name
	content_items['video_url'] = converted_video_url
	post.content = str(render_to_string('news_web.tpl', content_items))

	post.terms_names = {
		'category' : [u'新游预告']
	}

	if news.screenshot_path_1.name != '':
		post.custom_fields = []
		post.custom_fields.append({'key':'post_image','value':settings.MEDIA_URL + news.screenshot_path_1.name})

	post.post_status = 'publish'

	return WebMessage(news.id, post)
开发者ID:talentsun,项目名称:bestgames,代码行数:33,代码来源:web_message_builder.py

示例8: postInWordpress

# 需要导入模块: from wordpress_xmlrpc import WordPressPost [as 别名]
# 或者: from wordpress_xmlrpc.WordPressPost import terms_names [as 别名]
 def postInWordpress(self, title, content, ):
     post = WordPressPost()
     post.title = title
     post.content = content
     post.post_status = 'publish'
     post.terms_names = {'post_tag': ['leak', 'pastebin leak', 'hack leak', 'hack'],'category': ['Leaks']}
     post.id = self.wordpress.call(NewPost(post))
     p = self.wordpress.call(GetPosts())[0]
     return p.link
开发者ID:AlejandroMoran,项目名称:LeaksCrawler,代码行数:11,代码来源:Crawler.py

示例9: prepare_post

# 需要导入模块: from wordpress_xmlrpc import WordPressPost [as 别名]
# 或者: from wordpress_xmlrpc.WordPressPost import terms_names [as 别名]
def prepare_post(event):
    post = WordPressPost()
    post.title = event['Headline']
    body_string = '''<p id="pagekeeper"><img src='http://free.pagepeeker.com/v2/thumbs.php?size=x&url={}'><br/>{}</p><p>{}</p>'''.format(event["Media"], event["Media Credit"].replace("\n", ""), event["Text"])
    post.content = body_string
    post.date = parser.parse(event['Start Date'])
    post.terms_names = {'post_tag': [event['Tag']]}
    post.post_status = 'publish'
    return post
开发者ID:marcellmars,项目名称:sammox,代码行数:11,代码来源:timelinejs_wordpress.py

示例10: add_post

# 需要导入模块: from wordpress_xmlrpc import WordPressPost [as 别名]
# 或者: from wordpress_xmlrpc.WordPressPost import terms_names [as 别名]
def add_post(wp, title, body, category, date):
  date = datetime.strptime("%s 12:00:00 AM" % date, "%d-%b-%y %I:%M:%S %p")

	post = WordPressPost()
	post.title = title
	post.content = body
	post.terms_names = { 'category': [category,] }
	post.date = date
	post.post_status = 'publish'
	wp.call(NewPost(post))
开发者ID:HughP,项目名称:python-wordpress-import,代码行数:12,代码来源:import.py

示例11: newPost

# 需要导入模块: from wordpress_xmlrpc import WordPressPost [as 别名]
# 或者: from wordpress_xmlrpc.WordPressPost import terms_names [as 别名]
def newPost(title, content, tags, cats):
    post = WordPressPost()
    post.title = title
    post.content = content
    #post.post_status = 'publish'
    post.terms_names = {
    'post_tag': tags,
    'category': cats 
    }
    wp.call(NewPost(post))
开发者ID:tonycapone,项目名称:whatsfresh,代码行数:12,代码来源:wpPost.py

示例12: build

# 需要导入模块: from wordpress_xmlrpc import WordPressPost [as 别名]
# 或者: from wordpress_xmlrpc.WordPressPost import terms_names [as 别名]
 def build(self, title, content, categories=[], tags=[]):
     post = WordPressPost()
     post.title = title
     post.content = content
     post.terms_names = {
         'post_tag': tags,
         'category': categories,
     }
     post.post_status = 'publish'
     return NewPost(post)
开发者ID:smacpher,项目名称:HellaSlapsTheme,代码行数:12,代码来源:test.py

示例13: new_post

# 需要导入模块: from wordpress_xmlrpc import WordPressPost [as 别名]
# 或者: from wordpress_xmlrpc.WordPressPost import terms_names [as 别名]
def new_post(site_id, article_id, category=None, post_tag=None):
    site = Site.objects.get(pk=site_id)
    client = Client(site.url + '/xmlrpc.php', site.username, site.password)

    article = Article.objects.get(pk=article_id)

    post = WordPressPost()
    post.title = article.title
    post.content = article.context
    # ## post.post_status='publish'
    # ## 文章默认发布为草稿
    post.post_status = 'publish'

    if category:
        post.terms_names = {'category': category}
    if post_tag:
        post.terms_names = {'post_tag': post_tag}

    post_id = client.call(NewPost(post))
    return post_id
开发者ID:GoTop,项目名称:AutoSystem,代码行数:22,代码来源:wordpress.py

示例14: create_new_empty_wp_post

# 需要导入模块: from wordpress_xmlrpc import WordPressPost [as 别名]
# 或者: from wordpress_xmlrpc.WordPressPost import terms_names [as 别名]
def create_new_empty_wp_post(component, event_category, event_map_location, location_gps):

    summary = component.get('SUMMARY').encode('UTF-8', 'backslashreplace')
    start_event = component.get('DTSTART').dt.strftime('%Y-%m-%d %H:%M')
    end_event = component.get('DTEND').dt.strftime('%Y-%m-%d %H:%M')
    end_frequency_event = component.get('DTEND').dt.strftime('%Y-%m-%d')
    uid = component.get('UID').encode('UTF-8', 'backslashreplace')
    event_description = component.get('DESCRIPTION')
    if event_description is None:
        event_description = " "
    else:
        event_description = component.get('DESCRIPTION').encode('UTF-8', 'backslashreplace')

    # Create a new post
    new_post = WordPressPost()
    new_post.title = summary
    new_post.content = event_description
    new_post.post_type = "event"
    new_post.post_status = "publish"
    new_post.terms_names = {'event-category': [event_category]}
    new_post.custom_fields = []

    meta_adds = (['imic_event_start_dt', start_event],
                 ['imic_event_end_dt', end_event],
                 ['imic_event_frequency_end', end_frequency_event],
                 ['imic_featured_event', 'no'],
                 ['slide_template', 'default'],
                 ['imic_event_day_month', 'first'],
                 ['imic_event_week_day', 'sunday'],
                 ['imic_event_frequency_type', '0'],
                 ['imic_event_frequency', '35'],
                 ['imic_event_registration', '0'],
                 ['imic_custom_event_registration_target', '0'],
                 ['imic_sidebar_columns_layout', '3'],
                 ['imic_google_map_track', '1'],
                 ['imic_event_address2', event_map_location],
                 ['imic_event_map_location', location_gps],
                 ['imic_pages_banner_overlay', '0'],
                 ['imic_pages_banner_animation', '0'],
                 ['imic_pages_select_revolution_from_list', '[rev_slider fsl]'],
                 ['imic_pages_slider_pagination', 'no'],
                 ['imic_pages_slider_auto_slide', 'no'],
                 ['imic_pages_slider_direction_arrows', 'no'],
                 ['imic_pages_slider_interval', '7000'],
                 ['imic_pages_slider_effects', 'fade'],
                 ['imic_pages_nivo_effects', 'sliceDown'],
                 ['imic_import_uid', uid])

    # Iterate over array creating meta in post
    for i in meta_adds:
        new_post.custom_fields.append({'key': i[0], 'value': i[1]})

    return new_post
开发者ID:abjectio,项目名称:wp-labora-py,代码行数:55,代码来源:wputil.py

示例15: create_wordpress_draft

# 需要导入模块: from wordpress_xmlrpc import WordPressPost [as 别名]
# 或者: from wordpress_xmlrpc.WordPressPost import terms_names [as 别名]
def create_wordpress_draft(publish_target, title, html, tags):
  post = WordPressPost()
  today = datetime.date.today()
  post.title = title
  post.content = html
  client = Client( publish_target["url"] + "/xmlrpc.php",  publish_target["username"],  publish_target["password"])
  category = client.call(taxonomies.GetTerm('category',  publish_target["default_category_id"]))
  post.terms.append(category)
  post.user = publish_target["default_user_id"]
  post.terms_names = {'post_tag': tags}
  post.comment_status = 'open'
  post.id = client.call(posts.NewPost(post))
  return post
开发者ID:Arsenalist,项目名称:Quick-Reaction,代码行数:15,代码来源:app.py


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