Search This Site

Custom Search

Sunday, January 9, 2011

Re: [bloggerDev] newbie

#!/usr/bin/python

from gdata import service
import gdata
import atom
import getopt
import sys


class Blogit:
def __init__(self,email,password):
# Authenticate using ClientLogin.
self.service = service.GDataService(email, password)
self.service.source = 'myblog_client-1.0'
self.service.service = 'blogger'
self.service.account_type = 'GOOGLE'
self.service.server = 'www.blogger.com'
self.service.ProgrammaticLogin()
# Get the blog ID for the first blog.
feed = self.service.Get('/feeds/default/blogs')
self_link = feed.entry[0].GetSelfLink()
if self_link:
self.blog_id = self_link.href.split('/')[-1]

def PrintUserBlogTitles(self):
"""Prints a list of all the user's blogs."""
# Request the feed.
query = service.Query()
query.feed = '/feeds/default/blogs'
feed = self.service.Get(query.ToUri())
# Print the results.
print feed.title.text
for entry in feed.entry:
print "\t" + entry.title.text

def main():
myblog = Blogit(email,password)

email=raw_input("enter the email: ")
password=raw_input("enter the password: ")

if __name__ == '__main__':
main()
Brett Morgan,

Thanks for the link. I downloaded the example program and executed.
It listed my blogs and also posted a test post to my blog. I also
tried to write a similar program but it is not executing
properly.After entering the email and password, it waits for sometime
and the ends the execution. I'm attaching source file.

I used:
gdata-2.0.13
OS: Ubuntu 10.10
python version is 2.6.6


Thanks,
Arun Kumar

--
You received this message because you are subscribed to the Google Groups "Blogger Developer Group" group.
To post to this group, send email to bloggerdev@googlegroups.com.
To unsubscribe from this group, send email to bloggerdev+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/bloggerdev?hl=en.

No comments:

Post a Comment