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.
Gravatar icon
Thursday September 21, 2006 @ 09:59 AM (PDT)

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

Gravatar icon
Thursday September 21, 2006 @ 10:31 AM (PDT)

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. :/

Gravatar icon
Thursday September 21, 2006 @ 11:23 AM (PDT)
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 :)
Gravatar icon
Thursday September 21, 2006 @ 01:17 PM (PDT)

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!

Gravatar icon
Thursday September 21, 2006 @ 01:28 PM (PDT)

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

Gravatar icon
Saturday November 11, 2006 @ 12:26 AM (PST)

Read kellan's comment.

Gravatar icon
Saturday November 11, 2006 @ 10:11 AM (PST)

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.

Gravatar icon
Saxon Unrue
Friday November 17, 2006 @ 12:24 PM (PST)
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.
Gravatar icon
Thursday December 28, 2006 @ 12:43 PM (PST)

Thanks so much, this worked for me too : )

Gravatar icon
Michael
Saturday December 30, 2006 @ 02:25 AM (PST)

Thank you so much Kellan. Got it working. ^_^

Gravatar icon
Tuesday June 05, 2007 @ 11:18 PM (PDT)

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?

Gravatar icon
Michael
Saturday September 01, 2007 @ 11:01 PM (PDT)

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

Gravatar icon
Saturday September 22, 2007 @ 09:46 AM (PDT)

One thing to add to Gene's comment;

4. Restart your Mongrel server.

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

Gravatar icon
Matt
Saturday November 24, 2007 @ 05:04 PM (PST)

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

Gravatar icon
sati
Thursday January 24, 2008 @ 04:33 AM (PST)
New comment

required, won't be displayed

optional

Don't type anything here unless you're an evil robot:


And especially don't type anything here:

Basic XHTML (including links) is allowed, just don't try anything fishy. Your comment will be auto-formatted unless you use your own <p> tags for formatting. You're also welcome to use Textile.

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