Ejemplo n.º 1
0
def listposts(service, blogid):
    feed = service.Get('/feeds/' + blogid + '/posts/default')
    for post in feed.entry:
        h = post.GetHtmlLink
        raise Exception(h.href)
        print post.GetEditLink().href.split(
            '/')[-1], post.title.text, "[DRAFT]" if is_draft(post) else ""
Ejemplo n.º 2
0
def getblogs(service):
    feed = service.Get('/feeds/default/blogs')
    for blog in feed.entry:
        yield (blog.GetSelfLink().href.split('/')[-1], blog.title.text)
Ejemplo n.º 3
0
    if not opts.username and not opts.dump:
        opts.username = raw_input("Username: "******"Specify file name")

        if opts.dump:
            dump_blogpost(args[0])
        else:
            title, content = read_blogpost(args[0], opts.rawhtml, opts.title)
            service = login(opts.username, opts.password)
            if opts.change:
                entry = service.Get('/feeds/%s/posts/default/%s' %
                                    (opts.blog, opts.change))
                update_entry(entry, title, content)
                service.Put(entry, entry.GetEditLink().href)
            else:
                service.Post(create_entry(title, content),
                             '/feeds/' + opts.blog + '/posts/default')
Ejemplo n.º 4
0
def lastpost(service, blogid):
    feed = service.Get('/feeds/' + blogid + '/posts/default')
    post = feed.entry[-1]
    hl = post.GetHtmlLink()
    return hl.href