示例#1
0
def posttoWP():
    request = urllib2.Request(url)
    request.add_header('Authorization', credentialBing)
    requestOpener = urllib2.build_opener()
    response = requestOpener.open(request) 

    results = json.load(response)
    image = results['d']['results'][0]['Thumbnail']['MediaUrl']
    response = requests.get(image, stream=True)
    with open('testimage'+h+m+s+'.jpg', 'wb') as out_file:
        shutil.copyfileobj(response.raw, out_file)
    del response
    print image

    url = "http://www.easyinjury.com/xmlrpc.php"
    ##URL: www.easyinjury.com
    ##username: James
    ##pwd: mUFmNPvaXefAlgVTaTE#B2ku

    wp = wordpresslib.WordPressClient(url, 'James', 'mUFmNPvaXefAlgVTaTE#B2ku')
    wp.selectBlog(0)
    imageSrc = wp.newMediaObject('testimage'+h+m+s+'.jpg') #Used this format so that if i post images with the same name its unlikely they will override eachother

    img = '/wp-content/uploads/'+yr+'/'+mo+'/testimage'+h+m+s+'.jpg'

    post = wordpresslib.WordPressPost()

    post.title = 'Title'
    post.description = '<img src="'+img+'"/>' + 'Content'
    post.tags = ["wordpress", "lib", "python"]

    # Set to False to save as a draft
    idPost = wp.newPost(post, True)
示例#2
0
 def process_item(self, item, spider):
     self.rpc.selectBlog(0)
     article = item['raw']
     post = wordpresslib.WordPressPost()
     post.title = article['title']
     post.description = article['body']['und'][0]['safe_value']
     idPost = self.rpc.newPost(post, True)
     return item
示例#3
0
def postarEmtodos(blog,
                  titulo,
                  descricao,
                  link,
                  foto="",
                  categorias=["Tecnologia da Informação"],
                  tags=["Tecnologia da Informação"],
                  perc=0.8):

    for x in range(0, len(blogs)):
        if random.random() > perc:
            print blogs[x] + ".wordpress.com"

            url = 'https://' + blogs[x] + '.wordpress.com/xmlrpc.php'
            wp = wordpresslib.WordPressClient(
                url, 'pessoal' + str(x + 1) + '@egonkirchof.com.br',
                'pessoal123')
            wp.selectBlog(0)

            # VER NUMERO DA IMAGEM
            if foto != "":
                arquivo = foto  #'blogimg3.jpg'
                imageSrc = wp.newMediaObject('c:\\users\\egon\\downloads\\' +
                                             arquivo)
                #VER ANO E MES
                img = 'http://' + blogs[
                    x] + '.files.wordpress.com/2016/05/' + arquivo

            while True:  # escolhe parceiro
                idx = random.randint(0, len(blogs) - 1)
                if idx != x:
                    break

            parceiro = "https://" + blogs[idx] + ".wordpress.com"
            nome = nomes[idx]

            post = wordpresslib.WordPressPost()
            post.title = titulo
            desc = descricao
            if foto != "":
                desc = desc + "<br><p><img src='" + img + "'/>"

            txt = saibamais[random.randint(0, len(saibamais) - 1)]
            desc = desc + "<br><p>" + txt + "<a href='" + link + "'> clicando aqui</a>"
            txt = visite[random.randint(0, len(visite) - 1)]
            desc = desc + "<br><p>" + txt + "<a href='" + parceiro + "'>" + nome + "</a>"
            post.description = desc

            post.tags = tags
            post.categories = categorias
            #idp = wp.newPost(post,True)
            # print "(pausa)"
            time.sleep(1)

    print "...fim"
示例#4
0
def novopost(nroblog, titulo, descricao, link, foto, categorias, tags):

    blog = infoblogs.blogs[nroblog]
    # print blog+".wordpress.com"
    url = 'https://' + blog + '.wordpress.com/xmlrpc.php'
    wp = wordpresslib.WordPressClient(url, blog, 'pessoal123')
    #'pessoal'+str(nroblog+1)+'@egonkirchof.com.br','pessoal123')
    wp.selectBlog(0)

    if foto != "":
        arquivo = foto
        caminho = 'c:\\users\\egon\\downloads\\imagens blog\\' + arquivo
        if not os.path.isfile(caminho):
            print "foto nao encontrada: " + foto
            foto = ""
        else:
            imageSrc = wp.newMediaObject(caminho)
            #VER ANO E MES
            img = 'http://' + blog + '.files.wordpress.com/2017/02/' + arquivo

    while True:  # escolhe parceiro
        idx = random.randint(0, len(infoblogs.blogs) - 1)
        if idx != nroblog:
            break

    parceiro = "https://" + infoblogs.blogs[idx] + ".wordpress.com"
    nome = infoblogs.nomes[idx]

    post = wordpresslib.WordPressPost()
    post.title = titulo
    txt = infoblogs.antes[random.randint(0, len(infoblogs.antes) - 1)]
    desc = txt + "<br><p><p>" + descricao

    if foto != "":
        desc = desc + "<br><p><img src='" + img + "'/>"

    #add link
    if link != "":
        txt = infoblogs.saibamais[random.randint(0,
                                                 len(infoblogs.saibamais) - 1)]
        desc = desc + "<br><p>" + txt + "<a href='" + link + "'> clicando aqui</a>"

    txt = infoblogs.visite[random.randint(0, len(infoblogs.visite) - 1)]
    desc = desc + "<br><p>" + txt + "<a href='" + parceiro + "'>" + nome + "</a>"
    txt = infoblogs.depois[random.randint(0, len(infoblogs.depois) - 1)]
    desc = desc + "<br><p><p>" + txt

    post.description = desc

    post.tags = tags
    post.categories = categorias
    try:
        idp = wp.newPost(post, True)
    except WordPressException as e:
        print "*** Erro ao postar: " + e.message
示例#5
0
 def testEditPost(self):
     categories = tuple(self.wp.getCategoryList())
     lastPost = self.wp.getLastPost()
     self.failUnless(lastPost, 'last post is None')
     p = wordpresslib.WordPressPost()
     p.title = lastPost.title + ' (modificato)'
     p.date = time.time()
     p.description = lastPost.description + u'<br><br><em>Questa \xe8 una stringa unicode modificata</em>'
     p.categories = map(self.wp.getCategoryIdFromName,
                        ('Python', 'Progetti'))
     self.wp.editPost(lastPost.id, p, True)
示例#6
0
    def testNewPost(self):
        categories = tuple(self.wp.getCategoryList())
        p = wordpresslib.WordPressPost()
        p.title = 'Test'
        p.description = u'Questo \xe8 una stringa unicode'
        p.categories = (self.wp.getCategoryIdFromName('Progetti'), )
        idNewPost = self.wp.newPost(p, True)
        self.ifEmpty(idNewPost, 'new post id')
        self.failIf(idNewPost < 1, 'new post id is less than 0')

        result = self.wp.deletePost(idNewPost)
        self.failUnless(
            result,
            'deletePost %d failed, return=%s' % (idNewPost, str(result)))
示例#7
0
 def _post(title, tags, body, category, hostinfo):
     url = 'http://' + hostinfo[2] + "/xmlrpc.php"
     wpc = wordpresslib.WordPressClient(url, hostinfo[0], hostinfo[1])
     wpc.selectBlog(0)
     post = wordpresslib.WordPressPost()
     post.title = title
     post.description = body
     post.tags = tags
     post.categories.append(category)
     try:
         idPost = wpc.newPost(post, True)
     except:
         print "Error"
         return False
     return True
示例#8
0
 def publish_entry(self, entry):
     categories = [1]
     self.select_post_id()
     post = wordpresslib.WordPressPost()
     post.title = entry.get_title()
     post.categories = categories
     post.description = entry.get_body()
     if not post.title: raise IncompleteEntryError('title')
     if not post.categories: raise IncompleteEntryError('categories')
     if not post.description: raise IncompleteEntryError('description')
     try:
         self.__connection.newPost(post, True)
         return True
     except (socket.gaierror, wordpresslib.WordPressException):
         msg = traceback.format_exc()
         if ('[Errno -2] Name or service not known' in msg):
             return 'connection error'
         elif ('Bad login/pass combination' in msg):
             return 'username/password error'
示例#9
0
 def get_post(self):
     """
     Return  wordpresslib.WordPressPost with ID self.id from Wordpress
     server.
     Sets self.id, self.title, self.url, self.created_at.
     """
     verbose('getting %s %s...' % (self.post_type, self.id))
     if self.options.dry_run:
         post = wordpresslib.WordPressPost()  # Stub.
     else:
         if self.is_page():
             post = self.server.getPage(self.id)
         else:
             post = self.server.getPost(self.id)
     self.id = post.id
     self.url = post.permaLink
     self.categories = post.categories
     # UTC struct_time to UTC timestamp.
     if not self.options.dry_run:
         self.created_at = calendar.timegm(post.date)
     else:
         self.created_at = time.time()  # Dummy current time.
     return post
示例#10
0
def postToWP(title, article, url_bing):
    request = urllib2.Request(url_bing)
    request.add_header('Authorization', credentialBing)
    requestOpener = urllib2.build_opener()
    response = requestOpener.open(request)

    results = json.load(response)
    l = len(results['d']['results'])
    image = results['d']['results'][random.randint(0, l -
                                                   1)]['Thumbnail']['MediaUrl']
    response = requests.get(image, stream=True)
    with open('testimage' + h + m + s + '.jpg', 'wb') as out_file:
        shutil.copyfileobj(response.raw, out_file)
    del response

    url = "http://www.cloudhostingcom.com/xmlrpc.php"
    ##username: James
    ##pwd: mUFmNPvaXefAlgVTaTE#B2ku

    wp = wordpresslib.WordPressClient(url, 'admin', 'wIn$j5vG$#NryzJGGlBMd20J')
    wp.selectBlog(0)
    imageSrc = wp.newMediaObject(
        'testimage' + h + m + s + '.jpg'
    )  #Used this format so that if i post images with the same name its unlikely they will override eachother

    img = '/wp-content/uploads/' + yr + '/' + mo + '/testimage' + h + m + s + '.jpg'

    post = wordpresslib.WordPressPost()

    post.title = title
    post.description = '<img src="' + img + '"/> \n' + article
    #post.tags = ["wordpress", "lib", "python"]

    # Set to False to save as a draft
    idPost = wp.newPost(post, True)
    print "Article Posted"
    return True
示例#11
0
 def post(self):
     """
     Update an existing Wordpress post if post_id is not None,
     else create a new post.
     The blog_file can be either an AsciiDoc file or an
     HTML file (self.doctype == True).
     """
     # Create wordpresslib.WordPressPost object.
     if self.id is not None:
         post = self.get_post()
     else:
         post = wordpresslib.WordPressPost()
     # Set post title.
     if not self.title:
         if self.is_html():
             die('missing title: use --title option')
         else:
             # AsciiDoc blog file.
             self.set_title_from_blog_file()
     post.title = self.title
     assert (self.title)
     # Generate blog content from blog file.
     if self.is_html():
         self.content = open(self.blog_file)
     else:
         self.asciidoc2html()
     # Conditionally upload media files.
     if self.options.media:
         self.process_media()
     # Make HTML WordPress friendly.
     self.sanitize_html()
     # Set post content.
     s = re.split(r'<!--\s*more\s*-->', self.content.read(), maxsplit=1)
     post.description = s[0]
     if len(s) == 2:
         post.textMore = s[1]
     # Create/update post.
     # Only update if blog file has changed.
     checksum = md5.new(open(self.blog_file, 'rb').read()).hexdigest()
     if not (self.options.force or self.checksum is None
             or self.checksum != checksum):
         infomsg('skipping unmodified: %s' % self.blog_file)
     else:
         self.checksum = checksum
         action = 'updating' if self.id else 'creating'
         infomsg("%s %s %s '%s'..." % \
                 (action, self.status, self.post_type, self.title))
         if not self.options.dry_run:
             if self.id is None:
                 if self.is_page():
                     self.id = self.server.newPage(post,
                                                   self.is_published())
                 else:
                     self.id = self.server.newPost(post,
                                                   self.is_published())
             else:
                 if self.is_page():
                     self.server.editPage(self.id, post,
                                          self.is_published())
                 else:
                     self.server.editPost(self.id, post,
                                          self.is_published())
         infomsg('id: %s' % self.id)
         # Get post so we can find what it's url and creation date is.
         post = self.get_post()
         infomsg('url: %s' % post.permaLink)
         self.updated_at = int(time.time())
     self.save_cache()
示例#12
0
    def run(self, *args, **kwargs):
        if not args: args = sys.argv[1:]
        self.parse_args(args)
        config = self.config

        url = config.get('account', 'url')
        username = config.get('account', 'username')
        password = config.get('account', 'password')
        if config.has_option('account', 'verbose'):
            self.VERBOSE = config.get('account', 'verbose')

        print "Connecting to WP server at", url
        wp = None
        if not self.preview:
            self.wp = wp = self.create_client(url, username, password)

        if self.VERBOSE:
            options = wp.get_options()
            print "Talking to %s version %s" % (options['software_name'],
                                                options['software_version'])

        if not self.preview:
            if self.list_tags:
                return self.run_list_tags()
            elif self.list_categories:
                return self.run_list_categories()

        with file(self.filename) as f:
            self.text = text = f.read()

        # self.text is the version we eventually save;
        # text is the version we render
        text = text + self._known_link_stanza()
        reader = WordPressReader(self.preview)

        used_images = {}
        writer = docutils.writers.html4css1.Writer()
        writer.translator_class = MyTranslator

        directive_uris = {'image': {}, 'upload': {}}

        categories = [self.config.get('config', 'default_category')]
        if not self.dont_check_tags and not self.preview:
            validity.Validity.verify_categories(wp, categories)

        settings_dict = {
            'wordpress_instance': wp,
            'application': self,
            'bibliographic_fields': {
                'categories': categories
            },
            'directive_uris': directive_uris,
            'used_images': used_images,
            'filename': self.filename,
            'syntax_highlight': 'short',
            'embed_stylesheet': 1
        }

        if not self.stylesheet == None:
            if os.path.exists(self.stylesheet):
                settings_dict['stylesheet_path'] = self.stylesheet
            else:
                print "WARN: stylesheet %s does not exist" % self.stylesheet

        output = core.publish_parts(source=text,
                                    writer=writer,
                                    reader=reader,
                                    settings_overrides=settings_dict)
        #print yaml.dump(output, default_flow_style=False)
        body = output['stylesheet'] + output['body']

        if self.preview:
            return self.run_preview(output)

        fields = reader.document.settings.bibliographic_fields

        # fields['categories'] is type 'docutils.nodes.reprunicode'
        print str(fields['categories'])

        categories = [
            wordpresslib.WordPressCategory(name=str(fields['categories']))
        ]
        # categories = [wordpresslib.WordPressCategory(name=cat) for cat in fields['categories']]

        tags = []
        for tag in fields.get('tags', []):
            if wp.has_tag(tag):
                tags.append(wp.get_tag(tag))
            else:
                tags.append(wordpresslib.WordPressTag(name=tag))
        # WP will replace \n with <br/>, which isn't what RST is
        # designed for. We short-circuit this by replacing all newlines
        # with spaces, which ought to be safe.
        body = utils.replace_newlines(body)

        print "categories: %s" % str(categories)

        new_post_data = {
            'title': unicode(fields['title']),
            'categories': categories,
            'tags': tags,
            'description': body,
        }

        if 'parent_id' in fields.keys():
            new_post_data['parent_id'] = int(fields['parent_id'])

        # Publish priority:
        # 1. --publish/--no-publish
        # 2. :publish: yes
        # 3. config publish_default
        # 4. default to false
        publish = None
        if publish == None: publish = self.publish
        if publish == None:
            publish = fields.get('publish', None)
            if publish == 'yes': publish = True
            if publish == 'no': publish = False
        if publish == None and config.has_option('config', 'publish_default'):
            publish = config.getboolean('config', 'publish_default')
        if publish == None: publish = False

        if self.has_post_info(reader.document, 'id'):
            post_id = self.get_post_info(reader.document, 'id')
            post_id = unicode(post_id)
            post = wp.get_post(post_id)

            post.__dict__.update(new_post_data)

            print "post_id %d, parent_id %d, title: %s" % (
                post.id, post.parent_id, post.title)

            if fields.get('type') == 'page':
                wp.edit_page(post_id, post, publish)
            else:
                wp.edit_post(post_id, post, publish)

        else:
            # FIXME: fields['date']
            user = wp.get_user_info()
            new_post_data['user'] = user.id
            post = wordpresslib.WordPressPost(**new_post_data)

            if fields.get('type') == 'page':
                post_id = wp.new_page(post, publish)
            else:
                post_id = wp.new_post(post, publish)

            self.save_post_info(reader.document, 'id', str(post_id))

        self.save_post_info(reader.document, 'title', fields['title'])
import wordpresslib
url = 'https://aprendatecnologiablog.wordpress.com/xmlrpc.php'
wp = wordpresslib.WordPressClient(url, '*****@*****.**',
                                  'pessoal123')
wp.selectBlog(0)

arquivo = 'blog2.jpg'
imageSrc = wp.newMediaObject('c:\\users\\egon\\downloads\\' + arquivo)
img = 'http://aprendatecnologiablog.files.wordpress.com/2016/05/' + arquivo

post = wordpresslib.WordPressPost()
post.title = "3Cansado de procurar?"
post.description = "Achou!<br>" + '<img src="' + img + '"/>'
idp = wp.newPost(post, True)
示例#14
0
def main():
    error_msg = ''
    input_file = sys.argv[1]  # Incoming file name
    # DIR_OFFSET is where the file being called is relative to where your shell is open to
    DIR_OFFSET = ''  # Empty until defined otherwise

    # Open LyXBlogger in a separate terminal
    term_open(input_file)

    pr3('LYXBLOGGER')
    pr3('Copyright 2010 - 2012 Jack Desert')
    pr3('Please send any comments, suggestions, or bug reports')
    pr3('to [email protected]')
    pr3('License: GNU GPL3. See <http://www.gnu.org/licenses>')
    pr3('Documentation at http://lyxblogger.nongnu.org\n')
    config = run_init_config()
    time.sleep(config.getfloat('DEFAULT', 'delay'))

    DIR_OFFSET = get_dir_offset(input_file)

    html, blog_title, ELYXER_ENGINE = get_html(
        input_file, config.get('DEFAULT', 'cut_flag'))

    keys = get_credentials(config)

    wordpress_url = keys.url
    user = keys.user
    password = keys.password

    # prepare client object
    wp = wordpresslib.WordPressClient(wordpress_url, user, password)

    # select blog id
    pr3('\nNEW OR EXISTING')
    while (1):
        pr3('Create New post or overwrite Existing? (N) E')
        cat_response = sys.stdin.readline().replace('\n', '')
        if cat_response == 'E' or cat_response == 'e':
            post_id = get_post_id(wp)
            break
        elif cat_response == 'N' or cat_response == 'n' or cat_response == '':
            post_id = 0
            pr3('Publishing new post')
            break
        else:
            pr3("Response Not Understood.\n")
    try:
        wp.selectBlog(post_id)
    except (gaierror, WordPressException):
        handle_gaierror()

    # create post object
    post = wordpresslib.WordPressPost()
    post.title = blog_title

    cat_id = get_cat_id(wp)
    # I have no idea why this takes a tuple (something, )
    post.categories = cat_id  #(cat_id,)
    # publish images
    html = up_images(html, wp, ELYXER_ENGINE, DIR_OFFSET)
    post.description = html
    # publish post
    pr3("\nWORDS\nLet's upload your thoughts")

    filesize = str(os.path.getsize(input_file) / 1024) + ' kB'
    pr3("Uploading xhtml: " + input_file + '.  Size: ' + filesize)
    try:
        if (post_id == 0):
            wp.newPost(post, True)
        else:
            wp.editPost(post_id, post, True)
    except (gaierror, WordPressException):
        handle_gaierror()

    pr3('\nSUCCESS!')
    pr3('You just published your document to ' + wordpress_url[7:-11])
    pr3('Thank you for using LyXBlogger.\n\n')
    wait_for_consumer()
示例#15
0
    def run(self, *args, **kwargs):
        if not args: args = sys.argv[1:]
        self.parse_args(args)
        config = self.config

        url = config.get('account', 'url')
        username = config.get('account', 'username')
        password = config.get('account', 'password')
        if config.has_option('account', 'verbose'):
            self.VERBOSE = config.get('account', 'verbose')

        print "Connecting to WP server at", url
        wp = None
        if not self.preview:
            self.wp = wp = self.create_client(url, username, password)

        if self.VERBOSE:
            options = wp.get_options()
            print "Talking to %s version %s" % (options['software_name'],
                                                options['software_version'])

        if not self.preview:
            if self.list_tags:
                return self.run_list_tags()
            elif self.list_categories:
                return self.run_list_categories()

        with file(self.filename) as f:
            self.text = text = f.read()

        # self.text is the version we eventually save;
        # text is the version we render
        text = text + self._known_link_stanza()
        reader = WordPressReader(self.preview)

        used_images = {}
        writer = docutils.writers.html4css1.Writer()
        writer.translator_class = MyTranslator

        directive_uris = {'image': {}, 'upload': {}}

        categories = [self.config.get('config', 'default_category')]
        if not self.dont_check_tags and not self.preview:
            validity.Validity.verify_categories(wp, categories)

        # FIXME: probably a better way to ensure these are present
        if not self.config.has_option('config', 'tab_width'):
            self.config.set('config', 'tab_width', '4')
            self.config.set('config', 'initial_header_level', '2')

        # Source path is for use include directive in rst file
        output = core.publish_parts(
            source=text,
            writer=writer,
            source_path=os.path.abspath(self.filename),
            reader=reader,
            settings_overrides={
                'wordpress_instance':
                wp,
                'application':
                self,
                'bibliographic_fields': {
                    'categories': categories
                },
                'directive_uris':
                directive_uris,
                'used_images':
                used_images,
                # FIXME: probably a nicer way to do this
                'filename':
                self.filename,
                'tab_width':
                self.config.getint('config', 'tab_width'),
                'initial_header_level':
                self.config.getint('config', 'initial_header_level'),
            })
        #print yaml.dump(output, default_flow_style=False)
        body = output['body']

        if self.preview:
            return self.run_preview(output)

        fields = reader.document.settings.bibliographic_fields

        categories = [
            wordpresslib.WordPressCategory(name=cat)
            for cat in fields['categories']
        ]
        tags = []
        for tag in fields.get('tags', []):
            if wp.has_tag(tag):
                tags.append(wp.get_tag(tag))
            else:
                tags.append(wordpresslib.WordPressTag(name=tag))
        # WP will replace \n with <br/>, which isn't what RST is
        # designed for. We short-circuit this by replacing all newlines
        # with spaces, which ought to be safe.
        body = utils.replace_newlines(body)

        new_post_data = {
            'title': unicode(fields['title']),
            'categories': categories,
            'tags': tags,
            'description': body,
        }

        if self.has_post_info(reader.document, 'id'):
            new_post = False
            post_id = self.get_post_info(reader.document, 'id')
            post_id = unicode(post_id)
            post = wp.get_post(post_id)
        else:
            new_post = True
            post = None

        # Post date
        # 1. Set bibliogrphic fields :date: in rst file
        # 2. New post will auto set if no :date: field
        # 3. Old post will retrieve publish and set
        # 4. Set :date: can only change in rst file manually
        # 5. :date: is NOT post last modify time, it's publish time in local dz
        if not 'date' in fields:
            if new_post:
                new_post_data['date'] = time.localtime()
            else:
                # Convert post time in UTC to localtime
                new_post_data['date'] = time.localtime(
                    time.mktime(post.date) - time.timezone)
            # Write :date: field
            self.save_post_info(
                reader.document, 'date',
                time.strftime("%Y-%m-%d %H:%M:%S", new_post_data['date']))
        else:
            new_post_data['date'] = datetime.datetime.strptime(
                fields['date'], '%Y-%m-%d %H:%M:%S').timetuple()

        # Publish priority:
        # 1. --publish/--no-publish
        # 2. :publish: yes
        # 3. config publish_default
        # 4. default to false
        publish = None
        if publish == None: publish = self.publish
        if publish == None:
            publish = fields.get('publish', None)
            if publish == 'yes': publish = True
            if publish == 'no': publish = False
        if publish == None and config.has_option('config', 'publish_default'):
            publish = config.getboolean('config', 'publish_default')
        if publish == None: publish = False

        if not new_post:
            post.__dict__.update(new_post_data)

            if fields.get('type') == 'page':
                wp.edit_page(post_id, post, publish)
            else:
                wp.edit_post(post_id, post, publish)

        else:
            user = wp.get_user_info()
            new_post_data['user'] = user.id
            post = wordpresslib.WordPressPost(**new_post_data)

            if fields.get('type') == 'page':
                post_id = wp.new_page(post, publish)
            else:
                post_id = wp.new_post(post, publish)
            self.save_post_info(reader.document, 'id', str(post_id))

        self.save_post_info(reader.document, 'title', fields['title'])

        # Print end messange and preview link
        print
        print 'Done, url for preview with permaLink:'
        print post.permaLink + '&preview=true'