Wednesday, September 3, 2008

How To Install Python Module for Google Data API Services on Fedora

Recent repetitive job for the past several days triggers my subtle and sleeping mind from doing another playful hobby. Just a thought, I have convinced myself, to do some boring but interesting play, atleast give Google API a try.That is, manage and administer Google data like Blogger posts via Google Data API connecting locally using python, or even Java, from my Fedora desktop.

Did my research and found some leads.

I managed to learn few tricks and Google API tips on managing posts (Google data) to and from Google blogger using Google API, :) it is tedious but interestingly open. You can learn it too!

If you wish to access your google data and services using google API via phyton, this can be done by using Google Data APIs or Google data. This Google API provides simple protocol for reading and writing data on Google web.

Each of the following Google services provides a Google data API:

    * Base
    * Blogger
    * Calendar
    * Picasa Web Albums
    * Spreadsheets
    * Documents List
    * Contacts
    * YouTube
    * Google Apps Provisioning
    * Code Search
    * Notebook

Sourced from Google API.

The Google Data Python Client Library provides a library and source code that make it easy to access data through Google Data APIs.

Now, one way to access Google data using Fedora is by using and installing python modules.

What is Python GData Module?

Python Gdata, sometimes referred to as python-gdata, in shortest definition, is a Python module for accessing online Google services, such as:

- Blogger
- Calendar
- Picasa Web Albums
- Spreadsheets
- YouTube
- Notebook

If you need to experiment stuff with Google data via python, python gdata installation is the first step.

How To Install Python GData on Fedora 9

# yum -y install python-gdata.noarch

The above would install the necessary requirements for you to be able to launch and execute python commands to access your Google data via web. Several requirements and dependencies are shown below:

  ElementTree - For XML parsing
  httplib - Part of the core Python library since version 2.0, so it should
already be present.
  urllib - For URL creation and URL encoding, should already be present in
current versions of Python.

Shown below is a snipped python code via python-data on managing and playing around with Google blogger data, as an example.

    # Demonstrate how to publish a public post.
    public_post = self.CreatePost("Back from vacation",
      "I didn't want to leave Aruba, but I ran out of money :(
",
      "Post author", False)
    print "Successfully created public post: \"" + public_post.title.text + "\".\n"

    # Demonstrate various feed queries.
    print "Now listing all posts."
    self.PrintAllPosts()
    print "Now listing all posts between 2007-04-04 and 2007-04-23."
    self.PrintPostsInDateRange("2007-04-04", "2007-04-23")

    # Demonstrate updating a post's title.
    print "Now updating the title of the post we just created:"
    public_post = self.UpdatePostTitle(public_post, "The party's over")
    print "Successfully changed the post's title to \"" + public_post.title.text + "\".\n"

Using this approach, and several hours of python programming, steps can be taken to extend your knowledge and  accomplish simple to complex Google API functions such as:
  • blogger batch postings
  • blogger batch deletions 
  • add/edit/delete/view of blogger posts
  • blogger posts/posts tags edits indirectly or directly and more
or even migrate and repost your thousand wordpress backup XML data to blogger. This has been possible with an extra help from the nice and wonderful Google staff like Mr. Jeffrey and Mr. Trevor.

I have to contact them since Blogger data posting has a default 50 limit posts per day quota. Thanks for the override help! :)

More Google API documentation can be found here.

Enjoy and have fun!

0 comments:

Sign up for PayPal and start accepting credit card payments instantly.
ILoveTux - howtos and news | About | Contact | TOS | Policy