Created
August 10, 2011 20:59
-
-
Save semifor/1138248 to your computer and use it in GitHub Desktop.
Simple OAuth test for DM access
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env perl | |
| use Modern::Perl; | |
| use Net::Twitter; | |
| my $nt = Net::Twitter->new( | |
| traits => [qw/OAuth API::REST RetryOnError/], | |
| consumer_key => 'MkkW2yJ2H1WTWhOIWlw', | |
| consumer_secret => '0oWd3jArJrEFOHUZu6b6NAsJShZoDiDtaLJCmrzdu8', | |
| ); | |
| printf "Authorize app at %s\nthen, eter the PIN#: ", $nt->get_authorization_url; | |
| my $pin = <STDIN>; | |
| chomp $pin; | |
| my @oauth = $nt->request_access_token(verifier => $pin); | |
| my $r = $nt->direct_messages; | |
| printf "success: %d direct messages read\n", scalar @$r; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment