|
|
Thread Tools | Display Modes |
|
#1
|
|
|
The laziest photographer
|
Problem with perl wrapper?
Hi, I am getting my feet wet with the perl wrapper for Smugmug.
It's logging in fine, but when I Try and print my albums its empty. I have one album called 'World' - why is it not showing up? Code:
print "Logging into Smugmug";
my $sm_api = WWW::SmugMug::API->new(
{
sm_api_key => $mykey,
secure => 1,
}
);
$rv=$sm_api->login_withPassword(
{
EmailAddress => 'my@email.com',
Password => 'mypassword',
}
);
print "Login result is ", $rv->{'stat'},"\n";
my $albums = $sm_api->albums_get();
foreach my $album (@{$albums->{'Albums'}}) {
$title=$album->{'title'};
print $title;
}
Logging into SmugmugLogin result is ok
__________________
inspire.roychowdhury.org |
|
|
|
|
#2
|
|
|
The laziest photographer
|
Ok, I did some more investigation. The 'stat' result for login is ok, but for the album_get, it returns 'Invalid API key'. The Key is exactly what I got from smugmug - I got two strings, a key and a secret. I am using the key - I don't see a provision to enter the secret in the perl APIs.
How come login worked then? Also, I found and older thread where someone posted you need to associate a cookie file to it. I know how to associate it to a user agent (LWP), but how do you connect it to $sm_api variable? Sorry, my knowledge of perl is very basic :-)
__________________
inspire.roychowdhury.org Last edited by arjunrc; Jul-08-2012 at 02:25 PM. |
|
|
|
|
#3
|
|
|
The laziest photographer
|
Ok, solved. I took at look at the code of WWW::Smugmug::API
To link it to a cookies file, you need to use the ua element of sm_api_key like so. This may help other folks using perl: Code:
my $cj=HTTP::Cookies->new(
file => "sm_cookies.dat",
autosave => 1,
);
print "Logging into Smugmug";
my $sm_api = WWW::SmugMug::API->new(
{
sm_api_key => $mykey,
secure => 1,
}
);
$sm_api->{ua}->cookie_jar($cj);
__________________
inspire.roychowdhury.org |
|
|
|
| Tell The World! | |
| Similar Threads | Thread Starter | Forum | Replies | Last Post | ![]() |
| 7d Frame Capture Problem | Rob Pauza | Cameras | 12 | Apr-19-2012 06:17 PM | |
| Big Problem accessing My site with Internet Explorer | LCPHOTO | Bug Reporting | 8 | Nov-19-2011 10:52 PM | |
| D80 problem | Giphsub | Cameras | 14 | Jan-17-2008 05:20 AM | |
| Hit Counter Problem | twincitiesphoto | SmugMug Pro Sales Support | 0 | Dec-30-2007 06:40 PM | |
| Weird problem with mapping | docwalker | SmugMug Support | 13 | May-30-2006 04:56 AM | |
| Thread Tools | |
| Display Modes | |
|
|