Google-cl : Commandline way to use Google services


24 Jun  

Google recently introduced command line  based support for many of its services. I have already posted few entries showing why you should use the command line based way rather than the GUI when you are meddling with Google App Engine.Well, this is some-what different.

Some of the services supported by Google are:

 

  • Picasa
  • YouTube
  • Spreadsheets
  • Documents
  • Notebook
  • Blogger
  • Calendar
  • Contacts
  • Google Health

 

In some cases you will find that the command line way is quite handy. A typical example is when you upload large number of photos to Picasa.

Google Command-line

 

GoogleCL is a python based application that uses the gdata libraries. The gdata libraries are also written in Python and you can download the same from here. It allows you to make API calls from the command line. GoogleCL simplifies the interface further and allows us to interface with Google server very easily.

Installation

 

Though Linux and Windows platforms are supported, Linux is the preferred platform. In this article I’m going to use my Ubuntu 10.4 for demonstrating the functions. You can download the source code from here. You can also find a .deb package as well. So if you are using any Debian based distribution (like Ubuntu) you can download this deb file. After installing the same you need to authorise for using the tool. 

 

For doing this, issue a command in this syntax:

 

google blogger post –title "some title" "some text"

 

Now this will allow you to enable the command line based access mechanism as shown below:

 

installing GoogleCL in ubuntu

 

When the browser opens up and displays the authorisation page, click  “Grant Access”

 

access permission - google accounts

 

Posting a Blog Entry

 

Many of you might be using the blogger service. You can post new blog entries using this method. All you have to do is to issue a command in the following syntax:

 

google blogger post –blog "Technology Blog" –tags "techblog, googlecl, testing" "A sample post using Google Cl"

 

Please note that here  “Technology Blog” is the name of the blog. This is required if you have multiple blogs linked to the same Google account. Once you issue this, the post will appear in your blog.

 

sample blog entry using GoogleCL

 

Google also allows you to post the entry by using a text file that contains the entry:

 

google blogger post –blog "Technology Blog" –tags "techblog, googlecl, testing" you_file_name

 

Well, this may not be that handy. But you can use the command line method for other services

 

Google Picasa Web

 

Assume that you have taken so many pictures and you want to upload all of them to Picasa. In this case, command line based method is the easiest way. You can simply issue:

 

google picasa create –title "Trip to Ireland" ~/MyPhotos/june/*.png

 

As you can see, all you have to do is to specify the name of the album and the folder where the pictures are located.

 

Useful Commands

 

Here are few other useful commands that you can try:

 

google contacts list Name,you@domain.com> contacts.csv

google youtube post –category Technology techblog.ogg

google docs edit –title "Same Techblog document"

google picasa delete –title "Test album"

Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • Blogplay

Tags: ,


TechBlog on Facebook

Leave a Reply