The Flickr API hates me

Wednesday September 20, 2006 @ 10:25 PM (PDT)

My Flickr API key stopped working a week or two ago. API calls just return an error message saying "Invalid API Key (Key has expired)". That's why there hasn't been a new picture on the photoblog in forever. Flickr's API key status page says my key is still valid and active. I've even created a new key, but it gets the same error.

I wrote about this in Flickr's FlickrBugs forum and got just one response, which is from someone having the same problem. Google searches turn up a few other people having the problem, but not recently, and I have no idea whether (or how) their problems were resolved. Has anyone else had this problem? What did you do to solve it? Does Flickr even care?

If this doesn't get fixed soon, I'm going to have to ditch using Flickr for the photoblog and go back to my old custom setup.

Update: A friendly Flickr employee was awesome enough to drop by and solve the problem (see the comments for details). Turns out the third-party Flickr.rb library I'm using has a bug and is sending its own (expired) API key instead of my active key. Not Flickr's fault at all. Thanks kellan!

Comments

Not that I'd discourage anyone from going with a homerolled solution but could you give a bit more info?

What API calls are you making? Are you trying to make authenticated calls or unauthenticated? Are you using a particular library or totally home rolled?

I looked up the key you created on the 14th and it is definitely still active, and works for me.

Though I'll admit it doesn't inspire confidence when I've got a typo in my own name.

I'm using Flickr.rb, which is one of the Ruby libraries listed on the Flickr Services page. Here's my entire script (with sensitive bits changed to protect the innocent):

#!/usr/bin/env ruby

require 'rubygems'
require_gem 'flickr'

photoblog_path = '/path/to/photoblog/thumbnail.jpg'

flickr = Flickr.new('[api key]')

photoblog = flickr.users('ryan@wonko.com').tag('photoblog')

File.open(photoblog_path, 'w') do |file|
  file.puts photoblog[0].file('Thumbnail')
end

My script hasn't changed in nearly a year, nor have I upgraded Flickr.rb. Things just suddenly stopped working. :/

The Flickr.rb key expired on August 30th.

Digging into the code its a bug in Flickr.rb. It instaniates a new instance of the Flickr API class as a delegate for the User objects (avoiding cyclical garbage collection or just a bad idea, who knows?) and fails to pass along your API key.

It fails over to its own hard coded key, which is expired.

I'm sure they'd appreciate a patch :)

Ouch. Good find. I was too lazy to bother digging into flickr.rb; I just assumed it worked. Looks like I made an ass out of me.

Thanks!

So what was the solution you used to fix the problem? I'm having the same issue and it's driving me crazy!

Where can I find Flickr.rb? I installed it with the gem and I can't find a single file called Flickr.rb on my computer.

It's located wherever your Ruby gems library is. For me it was here:

/opt/local/lib/ruby/gems/1.8/gems/flickr-1.0.0/flickr.rb

If you're on a *nix, you can search for it like this:

:; find / -name flickr.rb

Anyway, you can just find the Flickr class and edit the initialize method to default to your key.

I fixed flickr.rb and put it here if you want it: http://d2p.us/patches/flickr.rb Just replace your flickr.rb with this one. (insert a disclaimer here)

Anyone know how I would go about patching this so that it's fixed in the gem? Guess I could try to contact sco@scottraymond.net.

Thanks so much, this worked for me too : )

I updated flickr.rb with the patch above, but I'm still getting the same error. Anyone else still have this problem or know how to fix it?

Having problems in Aptana - this worked for me, here are the steps I took.

1. Download http://d2p.us/patches/flickr.rb

2. Go to Directory C:\Ruby\InstantRails\ruby\lib\ruby\gems\1.8\gems\flickr-1.0.0\

3. Replace flickr.rb with download from (1)

Thanks so much, this worked for me too : )

Gene

One thing to add to Gene's comment;

4. Restart your Mongrel server.

It worked for me too, once I restarted the server.

Hi all , plez help i am using Clibrary for flickr API , but after issuing make command it is giving error that: ======================================= undefined reference to "curl_free" ======================================= What could be the problem ..? Can any budy help me satish

Copyright © 2002-2012 Ryan Grove. All rights reserved.
Powered by Thoth.