GoogleCL: Command Line Tools for Google Services
Frederic Cambus November 22, 2010 [Miscellaneous]GoogleCL, which stands for Google Command Line, is a collection of tools allowing users to access the Google Data APIs. They are particularly useful for those who wish to accomplish automated tasks such as posting news articles on Blogger, scheduling appointments on Google Calendar, adding and editing documents on Google Docs, and so on and so far. On top of that, it also offer the ability to upload images and videos on Picasa and Youtube respectively.
GoogleCL is written in Python (requires version 2.5 or superior) and depends on the gdata Python client library (version 1.2.4 and up, preferably 2.0.x). At the time I'm writing this article, the latest versions of these tools are googlecl-0.9.11 and gdata-2.0.13, and you can follow these instructions in order to install them:
wget http://gdata-python-client.googlecode.com/files/gdata-2.0.13.tar.gz
tar xvfz gdata-2.0.13.tar.gz
cd gdata-2.0.13
sudo python setup.py install
wget http://googlecl.googlecode.com/files/googlecl-0.9.11.tar.gz
tar xvfz googlecl-0.9.11.tar.gz
cd googlecl-0.9.11
sudo python setup.py install
Once everything is setup, you can use the tool to access the following Google services: Blogger, Calendar, Contacts, Docs, Picasa and Youtube.
Here are some examples showing how to achieve some basic tasks:
google blogger post --title "GoogleCL" "GoogleCL is a fantastic tool!"
google calendar add "Job interview for the COBOL programmer position!"
google contacts add "Bobby, bobby@example.com"
google docs edit "Todo List"
google picasa create "Travel Pictures" ~/pictures/sealand/*.jpg
google youtube post --category Education googlecl.avi
However, you might get this error message when trying to perform some of the tasks mentioned above:
Traceback (most recent call last):
File "/usr/bin/google", line 812, in
main()
File "/usr/bin/google", line 798, in main
run_once(options, args)
File "/usr/bin/google", line 542, in run_once
googlecl.write_devkey(options.devkey)
File "/usr/lib/python2.5/site-packages/googlecl/__init__.py", line 546, in write_devkey
with open(key_path, 'w') as key_file:
IOError: [Errno 2] No such file or directory: '/home/foo/.local/share/googlecl/yt_devkey'
In order to fix that, one needs to create the directory in which GoogleCL can store the authorization credentials:
mkdir -p ~/.local/share/googlecl
And voila, you're now able to use GoogleCL: pretty straightforward, isn't it? Personally, I mainly use it for uploading video content on YouTube, as it allows me to do so using a VPS providing far better uplink speed than my home connection: definitely a great time saving tool I'm glad I came across.
GoogleCL project page: http://code.google.com/p/googlecl/