def sends():
    print len(targeturl)
    for i in range(len(targeturl)):
        #u=content1[i][0]
        url = "http://whuhan2013.github.io" + targeturl[i]
        print url
        a = Article(url, language='zh')
        a.download()
        a.parse()
        title = a.title
        dst = a.text

        #链接WordPress,输入xmlrpc链接,后台账号密码
        wp = Client('http://127.0.0.1:22222/xmlrpc.php', 'www', '!abc6')
        #示例:wp = Client('http://www.python-cn.com/xmlrpc.php','username','password')
        post = WordPressPost()
        post.title = title
        #post.post_type='test'
        #post.content = dst
        post.description = dst
        post.post_status = 'publish'
        #发送到WordPress
        wp.call(NewPost(post, True))
        time.sleep(3)
        print 'posts updates'
Ejemplo n.º 2
0
 def edit_post(self, blog, post_id):
     """
     Edit a post.
     """
     xmlrpc = self.get_xmlrpc(blog)
     post = WordPressPost()
     post.title = 'Edited post from api'
     post.description = 'Edited description'
     return xmlrpc.call(EditPost(post_id, post, True))
Ejemplo n.º 3
0
 def new_post(self, blog):
     """
     Create a new post.
     """
     xmlrpc = self.get_xmlrpc(blog)
     post = WordPressPost()
     post.title = 'New post from api'
     post.description = 'New description'
     return xmlrpc.call(NewPost(post, True))
Ejemplo n.º 4
0
 def post_new(self, title, content, categories = ['Mac OS X'], individual_tags = '', status = 'private', date = dt.datetime.now()):
     post = WordPressPost()
     post.title = title
     post.description = content
     tags = 'automatically posted' if (self.additional_tags == '')  else self.additional_tags + ', automatically posted'
     tags = individual_tags + tags
     post.tags = tags
     post.date_created = date
     post.post_status = status
     post.categories = categories
     self.__wp.call(NewPost(post, True))
Ejemplo n.º 5
0
 def post_new(self,
              title,
              content,
              categories=['Mac OS X'],
              individual_tags='',
              status='private',
              date=dt.datetime.now()):
     post = WordPressPost()
     post.title = title
     post.description = content
     tags = 'automatically posted' if (
         self.additional_tags
         == '') else self.additional_tags + ', automatically posted'
     tags = individual_tags + tags
     post.tags = tags
     post.date_created = date
     post.post_status = status
     post.categories = categories
     self.__wp.call(NewPost(post, True))
Ejemplo n.º 6
0
# -*- coding: utf-8 -*-

#depende de https://github.com/maxcutler/python-wordpress-xmlrpc
from wordpress_xmlrpc import Client, WordPressPost
from wordpress_xmlrpc.methods.posts import GetRecentPosts, NewPost
from wordpress_xmlrpc.methods.users import GetUserInfo

wp = Client('http://yupana.pontaodaeco.org/xmlrpc.php', 'gesuselva',
            'kernelpanic')

post = WordPressPost()
post.title = 'Que as atuais máquinas informacionais e comunicacionais não se contentem em veicular conteúdos representativos, mas que concorram igualmente para a confecção de novos agenciamentos de enunciação (individuais e/ou coletivos)?'
post.description = '<h1></h1><br><p>عبور الحدود aquilo que dissolve no solo e continua a jornada electroquímica dos corpos finalmente será separada daquilo que sempre esteve apenas permeando - <a href=\"https://github.com/glerm/yupana\"/>um dicionário em aglutinação movendo aqueles braços, pernas, cabeça, tripas.</a> esta árvore de sinais, continua se espalhando e entidades que חציית הגבול</p><img src=\"http://upload.wikimedia.org/wikipedia/commons/2/20/Boltzmanns-molecule.jpg\"/>'
post.tags = 'yupana, kernel'
post.categories = ['coding']
wp.call(NewPost(post, True))
Ejemplo n.º 7
0
# -*- coding: utf-8 -*-

#depende de https://github.com/maxcutler/python-wordpress-xmlrpc
from wordpress_xmlrpc import Client, WordPressPost
from wordpress_xmlrpc.methods.posts import GetRecentPosts, NewPost
from wordpress_xmlrpc.methods.users import GetUserInfo

wp = Client('http://yupana.pontaodaeco.org/xmlrpc.php', 'gesuselva', 'kernelpanic')


post = WordPressPost()
post.title = 'Que as atuais máquinas informacionais e comunicacionais não se contentem em veicular conteúdos representativos, mas que concorram igualmente para a confecção de novos agenciamentos de enunciação (individuais e/ou coletivos)?'
post.description = '<h1></h1><br><p>عبور الحدود aquilo que dissolve no solo e continua a jornada electroquímica dos corpos finalmente será separada daquilo que sempre esteve apenas permeando - <a href=\"https://github.com/glerm/yupana\"/>um dicionário em aglutinação movendo aqueles braços, pernas, cabeça, tripas.</a> esta árvore de sinais, continua se espalhando e entidades que חציית הגבול</p><img src=\"http://upload.wikimedia.org/wikipedia/commons/2/20/Boltzmanns-molecule.jpg\"/>'
post.tags = 'yupana, kernel'
post.categories = ['coding']
wp.call(NewPost(post, True))

Ejemplo n.º 8
0
	def preparePost(self, post):
		'''Prepare the post'''
		newPost = WordPressPost()
		newPost.title = post.title
		newPost.description = self.readPost(post.file_name)
		return newPost
Ejemplo n.º 9
0
p_description = p_description.replace("_", " ")
print p_description
p_format = sermon_vars['post_format']
p_categories = sermon_vars['post_categories']
p_category_id = sermon_vars['post_category_id']
p_tags = sermon_vars['post_tags']

rpc_url = sermon_vars['wp_rpc_url']
username = sermon_vars['wp_username']
password =  sermon_vars['wp_password']

wp = Client(rpc_url, username, password)

post = WordPressPost()
post.title = p_title
post.description = p_description
post.format = p_format
post.categories = p_categories
#post.terms = post_category_name
post.tags = p_tags

print post.title + ": " + post.description + " [posted]"
post_id = wp.call(NewPost(post, True))

#podpress: https://wordpress.org/support/topic/xml-rpc-support-1
file_prefix = today.strftime('Hoc4Service%y%b%d_')
sermon_file = file_prefix + 'sermon' + '.mp3'
file_url = today.strftime('http://hoctoga.org/english/recordings/%Y/' + sermon_file)

print file_url