Flickr-API

 view release on metacpan or  search on metacpan

examples/flickr_flickr_authentication.pl  view on Meta::CPAN

#!/usr/bin/perl
#
# Example for using Flickr's Deprecated Authentication
#

use warnings;
use strict;
use Flickr::API;
use Data::Dumper;
use Getopt::Long;
use Term::ReadKey;
use Term::ReadLine;
use Pod::Usage;

=pod

=head1 DESCRIPTION

The original Flickr Authentication has been deprecated in favor
of OAuth. The example flickr_oauth_authentication.pl should be
used in favor of this one. However, this script uses the deprecated--
but seemingly still alive-- Flickr authentication to go from having
just the api_key and api_secret to an authenticated token.

=head1 USAGE

 ./flickr_flickr_authentication.pl \
    --api_key="24680beef13579feed987654321ddcc6" \
    --api_secret="de0cafe4feed0242" \
  [ --perms={read,write,delete} \]
  [ --config_out="/path/to/a/writable/config.st" ]
  [ --help ]
  [ --man ]

If not specified, perms defaults to read.

--key and --api_key are synonymous and --secret and --api_secret 
are also synonymous.

The script will produce a url for you to enter into a browser
then prompt you to press [ENTER] once you have authenticated
on Flickr.

It then does a Data::Dumper dump of the parameter keys and
values which can be recorded for future use. If you want to
make it more complete, you could modify the script to format
and dump the information into a config file of some type.
Alternatively, you can use the --config_out to specify a
filename that the API can use to save itself into using the
storable format.


=head1 PROGRAM FLOW

Following the flow laid out in L<https://www.flickr.com/services/api/auth.howto.desktop.html> more or less.

=cut

=head2 Flickr Steps 1&2, Obtain and configure an api_key

Out of scope for this particular script. We are assuming you
have already obtained and configured youe api_key.


=cut


my $term = Term::ReadLine->new('Flickr deprecated authentication');
$term->ornaments(0);

my $which_rl = $term->ReadLine;

if ($which_rl eq "Term::ReadLine::Perl" or $which_rl eq "Term::ReadLine::Perl5") {

        warn "\n\nTerm::ReadLine::Perl and Term::ReadLine::Perl5 may display prompts" .
             "\nincorrectly. If this is the case for you, try adding \"PERL_RL=Stub\"" .
             "\nto the environment variables passed in with make test\n\n";

}


$Data::Dumper::Sortkeys = 1;



( run in 1.595 second using v1.01-cache-2.11-cpan-39bf76dae61 )