Thursday 20 June 2013

And legs for opera

As you will probably have seen, Twitter had changed its authorization scheme from XML to JSON meaning that the Oracle PLSQL XML based tweets no longer worked. I have been working hard to re-establish this process and have now completed my testing, and we are tweeting from oracle once again.

I have just Tweeted all companies that have been missing since Twitter changed the Authorization on the 11th June 2013. The twitter link is in the heading.

I have been able to accomplish v1.1 twitter app authorization by writing an external Perl script. This is not as difficult as it first appears although you will need to get all your ducks lined up in a nice row.

Chronologically, this is done by:

1. go onto http://search.cpan.org/ and first off make sure that your Module::Build is up to date - there are a couple of ways to do this dependent on if you are working with windows or linux. linux is pretty easy because one runs cpan as root, and then types in 'insert Module::Build'. On windows its a search and download and then copy the lib files to one of the Python @INC paths - if one runs "perl -e 'use Module::Build;'" you will see errors if this is not loaded, and you will see the path if you get an error.

2. cpan Net::Twitter

3. cpan DBI

4. write your Perl script to access the database and tweet.

The following is a very simple Perl script to test if one has competed everything as required:
(of course you will need the tokens and secrets from Twitter here)

--=====================
#!/usr/bin/perl

use Net::Twitter;

my $nt = Net::Twitter->new(
    traits              => [qw/API::RESTv1_1/],
    consumer_key        => 'xxx',
    consumer_secret     => 'yyy',
    access_token        => 'zzz',
    access_token_secret  => 'aaa',
);

$nt->update({ status => 'Hello world' });

--=====================

save this as tweet.pl and then run as 'perl tweet.pl'

And Robert is your father's brother.

Comment or email if you are doing something similar and would like help.

No comments:

Post a Comment