Twitter CLI Teaser

I sort of forget what my original project entailed…something about tweeting via the command line, for Arduino purposes. You can pretty much just toss a bunch of words in a hat, and add ‘Arduino’ and ‘Command Line’ to them, and there you have one of my typical projects.

Anyhow, here we find ourselves. I am missing some dependencies with OAuth, but have managed to get twitter working from an interactive python shell:

cli twitter

command line-y

This section is as much for my reference as it is for public knowledge…I snagged the commands that I ran to snag my comments. It first prints swantr0n (my dev account) and then my primary Twitter feed, @swantron

swantron@mini9:~$ python
Python 2.7.1+ (r271:86832, Apr 11 2011, 18:05:24)
[GCC 4.5.2] on linux2
Type “help”, “copyright”, “credits” or “license” for more information.
>>> import twitter
>>> api = twitter.Api()
>>> feedSwantron = api.GetUserTimeline(‘swantron’)
>>> feedSwantr0n = api.GetUserTimeline(‘swantr0n’)
>>> print [ x.text for x in feedSwantr0n]
[‘development account for @swantron | tune into http://t.co/SpDFBkK for projects’, ‘hello world’]
>>> print [ x.text for x in feedSwantron]
[‘@vftb …you better believe it’, ‘Twitter Project Teaser : http://t.co/7ZrOLUn | one step closer to tweeting from the #CLI … might take a run at make it tweet’, ‘Might need to implement some sleeves into my wardrobe… @adafruit just flipped the script with open source cuff links’, ‘unsafe at any speed… updating #ubuntu on the road http://t.co/Q8gfc56’, ‘Upgrading Mini 9 to #Ubuntu Natty http://t.co/7yT9w81 | posting to kill time… review here ( http://t.co/RM675lX ) lunch-aft on the morrow’, ‘http://swantron.com/basic-mower-cord-repair/ #DIY lawn mower repair from a #math major. spoiler: it works’, “#arduino no you didn’t http://swantron.com/html-to-python-to-arduino-to-lcd/ #LCD project, stepped up a bit”, ‘working on a python script to dump info from web to LCD http://swantron.com/python-teaser/ #arduino’, ‘http://youtu.be/MpomhE6dgww video of #boc unboxing (for the win)’, ‘#woot bag-o-crap unboxing @ http://swantron.com/woot-boc-unboxing/ not too shabby’, ‘http://swantron.com/compiz-error-in-ubuntu-natty/ still finding some compiz issues in #ubuntu 11.04’, ‘#Arduino project @ http://swantron.com/command-line-lcd-arduino-interface/ | driving LCD screen via command line’, ‘@RobotGrrl… what version are you running? I had no problems with IOIO / Droid 2 (froyo 2.2)’, ‘Easy LCD #Arduino Display | http://swantron.com/easy-lcd-arduino-display/ | feels good to have a warm soldering iron and functional hardware’]
>>>

I will keep plugging away until I get this thing hammered out. If not, I can print this suff to my LCD for a real-time Twitter display. Could be cool either way.

Twitter Project Teaser

A while back, I tossed a little concept video out to the nets regarding CLI interface with my site’s comments and an LCD screen. I figured that I could do a similar thing with my Twitter account…spurred largely by Adafruit’s Make it Tweet challenge. Well, it turns out that Twitter has a few hurdles to jump, in regards to posting tweets to an account.

My failed usage from the command line was utilising curl

> curl -u swantron:pass -d status=”command line test” http://twitter.com/statuses/update.xml

I was getting an error message, that basic authentication was not supported. For the loss.

It turns out that you need a few keys in order to authenticate, which requires registering an app with Twitter… like this

twitter dev account

dev-y

There we go…keys in hand. Now, I need to figure out how to sew this together using curl or wget. If all else fails, I am pretty sure there is a py library that I can snag. Stay tuned…this one could be fun.