Driving Twitter with just LUA
I was thinking about google calender and how the library is deprectated and that got me thinking... "is it possible to drive twitter with just LUA as it has to OAUTH and then pound a REST API just like googlecal does?"
So I compiled up a few lua helper modules and stamped out a simple LUA program that would talk to twitter.
local OAuth = require "OAuth"
oauth_token = "9xxxgIqm"
oauth_token_secret = "DptRmDxxxxxOXHv3eTNc"
consumer_secret="6iaSFRxxxxcFNv7lQyoA"
consumer_key="hmGxxxxxnw"
client = OAuth.new(consumer_key, consumer_secret, {
RequestToken = "https://api.twitter.com/oauth/request_token",
AuthorizeUser = {"https://api.twitter.com/oauth/authorize", method = "GET"},
AccessToken = "https://api.twitter.com/oauth/access_token"
}, {
OAuthToken = oauth_token,
OAuthTokenSecret = oauth_token_secret
})
-- the mandatory "Hello World" example...
local response_code, response_headers, response_status_line, response_body =
client:PerformRequest("GET", "https://api.twitter.com/1.1/statuses/user_timeline.json", {screen_name = "dbzoo"})
print("response_code", response_code)
print("response_status_line", response_status_line)
for k,v in pairs(response_headers) do print(k,v) end
print("response_body", response_body)
Pretty simple for starters.... more to come.
Two points.
1. Where do we find the various tokens/keys
2. Would a similar 'Lua script based' approach work for Google Calendar (appreciate that this would involve a fair bit of effort)?
Cheers,
Derek.