Reputation: 388
I'm trying to download my own flickr albums using the API. I'm using the flickr.rb gem here I am creating a new object using this:
@flickr = Flickr.new({api_key: 'xxxxx', shared_secret: 'xxxxx', verify_ssl: false})
And then I'm using:
p = @flickr.photoset(photoset_id)
Where I pass the id of my photoset I want to download. I keep getting the error:
/.rvm/gems/ruby-2.2.5/gems/flickr.rb-1.2.1/lib/flickr.rb:199:in `request': Photoset not found (RuntimeError)
What is the correct way to authenticate to Flickr and download my photos? I don't want to build any UI, just want a command line app to do this. Is there some URL I need to hit in the browser to authorize the app and grant permissions? The documentation is really sparse and doesn't give any examples.
Update: In response to @r-f-nelson
The 'user' as retrieved:
#Flickr::User:0x007fd8cea6ad98 @id="29916617@N02", @username="taraporefarhad", @client=#<Flickr:0x007fd8cf09fc68 @host="https://api.flickr.com", @api="/services/rest", @verify_ssl=false, @api_key="36705xxxxxxxxxxxxxxx", @shared_secret="xxxxxxxxxxxxxx", @auth_token=nil, @ca_file=nil
The 'flickr' client object:
#Flickr:0x007fd8cf09fc68 @host="https://api.flickr.com", @api="/services/rest", @verify_ssl=false, @api_key="36705xxxxxxxxxxxxxxx", @shared_secret="xxxxxxxxxxxxxx", @auth_token=nil, @ca_file=nil, @user=#
Flickr::User:0x007fd8cea6ad98 @id="29916617@N02", @username="taraporefarhad", @client=#<Flickr:0x007fd8cf09fc68 ...
The Photoset object:
#Flickr::Photoset:0x007fd8cf06c9d0 @id="72157638843727066", @api_key=nil, @client=#<Flickr:0x007fd8cf06c8b8 @host="https://api.flickr.com", @api="/services/rest", @verify_ssl=true, @api_key=nil, @shared_secret=nil, @auth_token=nil, @ca_file=nil
/.rvm/gems/ruby-2.2.5/gems/flickr.rb-1.2.1/lib/flickr.rb:199:in `request': Invalid API Key (Key has invalid format) (RuntimeError)
Note above that the "photoset" object has a different flickr client object id and NO shared secret and API key! Not sure how that's happening since I'm using the same client and user objects to get the photoset as well.
Upvotes: 0
Views: 293
Reputation: 2312
Assuming you are successfully connecting to Flickr's API, you can browse your own photosets like so:
user = flickr.users('[email protected]')
photosets = user.photosets
From there you can iterate through your photosets to find the correct one. I'm guessing whatever id you're using is not the actual photoset_id
that the Flickr API uses.
Upvotes: 0