As it turns out twitter account can be updated in a single line, this makes writing “bots” just that little bit easier.
1 | /usr/bin/curl --basic --user "username:password" --data-ascii "your tweet" http://twitter.com/statuses/update.json |
This also returns JSON should you want to parse the reply data.
i.e.
1 | {"in_reply_to_screen_name":null,"in_reply_to_status_id":null,"truncated":false,"user":{"profile_image_url":"http:\/\/static.twitter.com\/images\/default_profile_normal.png","description":"","followers_count":0,"screen_name":"user","url":null,"name":"user","protected":true,"location":"","id":12345678},"text":"your tweet","favorited":false,"created_at":"Fri Mar 20 11:38:44 +0000 2009","in_reply_to_user_id":null,"id":1359757870,"source":"web"} |
At the moment I am looking at hooking this into Nagios, from there the feed will be passed into a ’service status page’.
But in theory this single line could be used for any purpose.
Tags: twitter
Entries (RSS)
[...] After taking another look at Python I am quickly coming to love it, as an “exercise” in re-learning python I decided to write a very simple command line “tweeter” this uses the Twitter API to update your twitter status, extending from the “update twitter in a single line” [...]
[...] Making the bird tweet using python or Update twitter in a single line [...]