Oracle Blog

The difference between insanity and genius is measured by success

Sunday Dec 06, 2009

Woke up at 11 in the morning, brushed my teeth and all...Sat down at my desk to study for the end semester exams tomorrow but did not feel like it...So decided to do something fun..

Twitter is quite popular and people are just dying to join up and tell everyone what they are doing, what they had for breakfast, when they are going shopping and other such 'important' details about their daily life, whether people care to listen or not. Nevertheless its a good service.

So yeah, coming back to the point. Long ago I had seen this shell script to tweet from the command line. And I have been into Python over the last few days, so decided to cook up one of my own in Python. Given below is the result of my last 20 minutes of work.

Caution: Won't work in windows because it does not have curl. Coming up with a Windows version soon.

Save the code in a file say 'tweet.py'.To run this do a chmod +x tweet.py and then just type ./tweet.py "Your message" and it will be posted. But before that, you will need to open up the tweet.py file and put in your Twitter username and password in it. Check out the third and second lines from the bottom. That is where your username and password goes, inside the quotes. And you are all set.

About

Hi. I am Sandip Dev. I am a student of Computer Engineering at SVNIT (NIT-Surat). My passions are coding, listening to music, reading and learning new things.
I am also the Chairperson of the ACM Chapter of my college and Sun Campus Ambassador here.