Changeset 7aa1fa5
- Timestamp:
- Nov 26, 2010, 4:59:22 AM (14 years ago)
- Branches:
- master, release-1.10, release-1.7, release-1.8, release-1.9
- Children:
- 2ff0693
- Parents:
- b31f1c9
- git-author:
- Nelson Elhage <nelhage@MIT.EDU> (11/07/10 08:30:32)
- git-committer:
- David Benjamin <davidben@mit.edu> (11/26/10 04:59:22)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
perl/modules/Twitter/lib/BarnOwl/Module/Twitter/Handle.pm
rc6adf17 r7aa1fa5 31 31 use POSIX qw(asctime); 32 32 33 use constant BARNOWL_CONSUMER_KEY => "9Py27vCQl6uB5V7ijmp31A"; 34 use constant BARNOWL_CONSUMER_SECRET => "GLhheSim8P5cVuk9FTM99KTEgWLW0LGl7gf54QWfg"; 33 use LWP::UserAgent; 34 use URI; 35 use JSON; 36 37 use constant CONSUMER_KEY_URI => 'http://barnowl.mit.edu/twitter-keys'; 38 our $oauth_keys; 39 40 sub fetch_keys { 41 my $ua = LWP::UserAgent->new; 42 $ua->timeout(5); 43 my $response = $ua->get(CONSUMER_KEY_URI); 44 if ($response->is_success) { 45 $oauth_keys = eval { from_json($response->decoded_content) }; 46 } else { 47 warn "[Twitter] Unable to download OAuth keys: $response->status_line\n"; 48 } 49 } 35 50 36 51 sub fail { … … 57 72 $cfg->{show_mentions} = $val; 58 73 } 74 75 76 if (!defined($oauth_keys)) { 77 fetch_keys(); 78 } 79 my $keys = $oauth_keys->{URI->new($cfg->{service})->canonical} || {}; 59 80 60 81 $cfg = { … … 65 86 publish_tweets => 0, 66 87 show_mentions => 1, 67 oauth_key => BARNOWL_CONSUMER_KEY,68 oauth_secret => BARNOWL_CONSUMER_SECRET,88 oauth_key => $keys->{oauth_key}, 89 oauth_secret => $keys->{oauth_secret}, 69 90 %$cfg, 70 91 };
Note: See TracChangeset
for help on using the changeset viewer.