Life@Net

Have you tried GoogleCL?

Posted in Uncategorized by Abhi Bhi Zinda Hun on June 22, 2010

Hey.. GoogleCL ( Go to http://google-opensource.blogspot.com/2010/06/introducing-google-command-line-tool.html ) is really awesome stuff from google :-) .

First you need to install Google Data Python Client LIb and then you can access google services from cmd line using GoogleCL :-) .

I just listed all docs of my Google Docs :-) . Now, I am set to do all cmd line stuffs :-) . Just need to write scripts :-) .

Basically, GoogleCL is a pure Python application that uses the Python gdata libraries to make Google Data API calls from the command line.

References:

1. For Google Data Python Client Library : http://code.google.com/apis/gdata/articles/python_client_lib.html

You have to have python 2.5 or higher.

2.
GoogleCL Project Page:
http://code.google.com/p/googlecl

Instructions For Installing GoogleCL:
1. DEPENDENCIES
GoogleCL requires Python 2.5 or 2.6 and the gdata python client library.
You can get the library from the project homepage:
http://code.google.com/p/gdata-python-client/

The installation directions for the client library should also contain
directions on installing Python, if you don’t have it already.

2. INSTALLING GOOGLECL
Short instructions:
From the command line, in the directory as this file, run
$ sudo python setup.py install

or

$ python setup.py install –home=~
(remember to set your PYTHONPATH to include your home directory if you
do it this way)

For more detailed instructions, I recommend looking at the gdata-python-client
INSTALL.txt file. It also has instructions on modifying PYTHONPATH.

After installing Google Data Python Lib ( http://code.google.com/apis/gdata/articles/python_client_lib.html ), you will have sample and example scripts. You can now write your own scripts for accessing various google services.

Just running docs_example.py :

51-196-201-123:gdata-2.0.10 chandratewary$ ./samples/docs/docs_example.py
NOTE: Please run these tests only with a test account.
Please enter your username: ctewary@gmail.com
Password:

Document List Sample
1) List your documents.
2) Search your documents.
3) Upload a document.
4) Download a document.
5) List a document’s permissions.
6) Add/change a document’s permissions.
7) Exit.

> 1
Retrieve (all/document/folder/presentation/spreadsheet/pdf):
Enter a category: all

TITLE TYPE RESOURCE ID
compensation pl… spreadsheet spreadsheet:0ApfFevdQHTHqdFZpemkyczItY2tTT25lZ2xXTFkxd3c
compensation pl… spreadsheet spreadsheet:0ApfFevdQHTHqdFA4VTBXRENJeXhUdVdiNXkwdE1aeHc
null spreadsheet spreadsheet:0ApfFevdQHTHqdFNBR1lsMnpiR1RJUXA3T3FqcVJZeUE
Inspiration document document:0AZfFevdQHTHqZHBucnY3NF8xOGRzNXQ1c2Nr
Degree Cert4 document document:0AZfFevdQHTHqZHBucnY3NF8xNmN2a3d0d2c5
Degree Cert2 00… document document:0AZfFevdQHTHqZHBucnY3NF8xNGczc2hnd2Z3
Degree Cert2 document document:0AZfFevdQHTHqZHBucnY3NF8xMmdzMm4zZmc2
Degree Cert1 document document:0AZfFevdQHTHqZHBucnY3NF8xMGZjbTMzcmNu
ai_designer_int… document document:0AZfFevdQHTHqZHBucnY3NF83ZGNxd2RjZmc
dw_designer_int… document document:0AZfFevdQHTHqZHBucnY3NF84Z3J0a2M4Y20
General_Qs_Inte… document document:0AZfFevdQHTHqZHBucnY3NF85ZGptc20yemc
Untitled Presen… presentation presentation:0AZfFevdQHTHqZHBucnY3NF82Y2hjYjRyY2g
1126_Dossier_P1 pdf pdf:0B5fFevdQHTHqMTE4MGQzMWEtY2FiYy00YmQ5LTlmNTctNWVlM2MyYzRlMDEy
Chandra_Shekhar… document document:0AZfFevdQHTHqZHBucnY3NF8zZmh4OXptaGY
Index document document:0AZfFevdQHTHqZHBucnY3NF8yZGI5dDR6YzM
ITPOfflinePayme… document document:0AZfFevdQHTHqZHBucnY3NF8xZmJrbnEzZmo
NIJobs – Job Se… document document:0AZfFevdQHTHqZHBucnY3NF8wYzV4NDZ2Zm0

Document List Sample
1) List your documents.
2) Search your documents.
3) Upload a document.
4) Download a document.
5) List a document’s permissions.
6) Add/change a document’s permissions.
7) Exit.

> 7

Goodbye.
51-196-201-123:gdata-2.0.10 chandratewary$

All these dirs have sample scripts for general use for various supported google services. If you want something more then you can also write for your own purpose.

51-196-201-123:samples chandratewary$ ls -lrt ../../gdata-2.0.10/samples/
total 0
drwxr-x—@ 5 chandratewary staff 170 May 13 01:00 webmastertools
drwxr-x—@ 3 chandratewary staff 102 May 13 01:00 spreadsheets
drwxr-x—@ 3 chandratewary staff 102 May 13 01:00 sites
drwxr-x—@ 6 chandratewary staff 204 May 13 01:00 oauth
drwxr-x—@ 3 chandratewary staff 102 May 13 01:00 mashups
drwxr-x—@ 3 chandratewary staff 102 May 13 01:00 maps
drwxr-x—@ 3 chandratewary staff 102 May 13 01:00 finance
drwxr-x—@ 4 chandratewary staff 136 May 13 01:00 docs
drwxr-x—@ 4 chandratewary staff 136 May 13 01:00 contacts
drwxr-x—@ 3 chandratewary staff 102 May 13 01:00 codesearch
drwxr-x—@ 3 chandratewary staff 102 May 13 01:00 calendar
drwxr-x—@ 6 chandratewary staff 204 May 13 01:00 blogger
drwxr-x—@ 6 chandratewary staff 204 May 13 01:00 base
drwxr-x—@ 3 chandratewary staff 102 May 13 01:00 authsub
drwxr-x—@ 3 chandratewary staff 102 May 13 01:00 apps
drwxr-x—@ 4 chandratewary staff 136 May 13 01:00 analytics

Currently, GoogleCL supports following services:

51-196-201-123:googlecl chandratewary$ ls -lrt
total 56
-rw-r–r–@ 1 chandratewary staff 7726 Jun 20 00:35 __init__.py
-rw-r–r–@ 1 chandratewary staff 18978 Jun 20 01:34 service.py
drwxr-xr-x@ 4 chandratewary staff 136 Jun 20 13:34 youtube
drwxr-xr-x@ 4 chandratewary staff 136 Jun 20 13:34 picasa
drwxr-xr-x@ 4 chandratewary staff 136 Jun 20 13:34 docs
drwxr-xr-x@ 4 chandratewary staff 136 Jun 20 13:34 contacts
drwxr-xr-x@ 4 chandratewary staff 136 Jun 20 13:34 calendar
drwxr-xr-x@ 4 chandratewary staff 136 Jun 20 13:34 blogger

Waiting for gmail :-)

What are you thinking? Really cool stuff :-) . Is not it?. Yes..so, go ahead and install…and do all those geeky stuffs for accessing google services from cmd line.

Other Links:

http://googlesystem.blogspot.com/2010/06/use-google-services-from-command-line.html

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.