twitter and moo

0 views
Skip to first unread message

Nathan Smith

unread,
Jul 18, 2016, 10:59:22 AM7/18/16
to MOO Talk
hi guys
So I went looking through the archives and quite by mistake stumbled across one or two articles talking about twitter and moo.
It would be super cool if I could get changes to be posted to twitter through my moo and so I ran the following code as a test:
con = `open_network_connection("twitter.com", 80) ! ANY';
if (typeof(con) == OBJ)
  player:tell(con);
  player:tell("I', working.");
  notify(con, "POST /statuses/update.json HTTP/1.1");
  notify(con, "Host: twitter.com");
  notify(con, "Authorization: Basic xxxxxxxxxxxxxxxx:xxxxxx");
  notify(con, "Content-Length: 38");
  notify(con, "");
  notify(con, "status=");
  notify(con, "Clue No fun been found by " + player.name);
endif
$network:close(con);


it does not cause tracebacks and both the player:tell tell me when I run, indicating it should be working. That being said no tweet appears.
What am I doing wrong here and/or what things do I need to kick in the server?
I appreciate your help here.
Thanks
Nathan

Wolfgang Faust

unread,
Jul 18, 2016, 11:43:46 AM7/18/16
to Nathan Smith, MOO Talk

Just because you don't get any tracebacks doesn't mean that the server didn't return an error message. You'll also want to read back from the socket and see what the server actually had to say.

With that said, here are some other hints which may or may not be helpful:
* I doubt that Twitter allows posting over HTTP anymore--IIRC they switched to
  HSTS and you have to connect over HTTPS. All you're going to get from HTTP
  is a 301 redirect.
* For that matter, I don't think they support Basic Authentication anymore either--
  you'll probably need to use OAuth.
* I think the /status/update.json API has been deprecated or removed in favour
  of https://dev.twitter.com/rest/reference/post/statuses/update
  (This API also expects an actual JSON object to be sent, I think.)


--
You received this message because you are subscribed to the Google Groups "MOO Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to MOO-talk+u...@googlegroups.com.
To post to this group, send email to MOO-...@googlegroups.com.
Visit this group at https://groups.google.com/group/MOO-talk.
For more options, visit https://groups.google.com/d/optout.

Wolfgang Faust

unread,
Jul 18, 2016, 12:49:18 PM7/18/16
to Just Johnny, Nathan Smith, MOO Talk
Thinking about this further, it seems like your best bet is to create a proxy server for the Twitter API in the language of your choice, and then have the MOO server talk to the proxy. That way the proxy server can handle SSL, OAuth, etc. and the MOO server can just talk to it over an ordinary TCP socket. (Obviously you'd want to make sure that the proxy server was only accessible to the MOO server and not the outside world, since there'd be no authentication.)

On Monday, July 18, 2016, Just Johnny <joh...@sindome.org> wrote:
Yeah, you're gonna hit a wall with this because moo can't connect via SSL and I've not seen anyone doing OAuth with MOO (and not suffering the lag monster). Been down this road, twitter hates people using its API anyway. :(


--
The views expressed above are exclusively mine, if anyone's.

Reply all
Reply to author
Forward
0 new messages