Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to develop a small Python tool to interact with my flickr account. I want to keep it simple so I decided to use the Flickr account I already have configured in my system (online accounts framework).

I have studied the Online Accounts for application developers tutorial and was able to get my Flickr account details.

The problem appeared when I tried to use the flickrapi module. I have tried the latest version from and as well as the version available via apt in 13.04. The API has changed a bit, but both tries ended with a message that I have an invalid oauth token. This is what I have tried:

latest source from flickrapi hg repo

import flickrapi
flickr = flickrapi.FlickrAPI(u"d87224f0b467093b2a87fd788d950e27", u"4c7e48102c226509",
                       u"my_token_secret", u"write",
                       u'DarGad', u'dargad', u'user_nsid'))

which leads to:

ERROR:flickrapi.auth.OAuthFlickrInterface:do_request: Status code 400 received, content:
ERROR:flickrapi.auth.OAuthFlickrInterface:    oauth_problem=parameter_absent
ERROR:flickrapi.auth.OAuthFlickrInterface:    oauth_parameters_absent=oauth_token

version from apt-get (1.2-3)

import flickrapi
flickr = flickrapi.FlickrAPI("d87224f0b467093b2a87fd788d950e27", "4c7e48102c226509", 

results with FlickrError: Error: 98: Invalid auth token. I have also tried different combinations of FlickrAPI constructor flags (e.g. store_token, cache) without success.

I have used a similar approach for Twitter (used python-twitter module from apt) and it worked perfectly with the account I already had configured.

My guess is the problem is with flickrapi, since the same token works with Shotwell and unity-photos-lens. I have checked their sources and none do not uses flickrapi (and Shotwell is not even in Python).

I will appreciate any hints on making flickrapi work with the online accounts framework. Or maybe there is another Python module that works correctly with online accounts? I have also tried and python-flickr-api but I got impression that both are outdated - no success with them either.

share|improve this question
up vote 0 down vote accepted

Looks like I have managed to find a way after all.

The correct version to be used is the version from the sources. The version shipped with Ubuntu 13.04 is too old and it uses previous flickr auth API. The 2.0-beta from hg uses the new oauth API.

The problem was that the token provided in the FlickrAPI constructor was not passed to the internal OAuthFlickrInterface. To workaround this problem I needed to simply call:

flickr = flickrapi.FlickrAPI(
                             # args same as before

if this method returns True we can make sure:

rsp = flickr.test.login()

This will perform an API call to check the token, but before doing so it will pass the token object to OAuthFlickrInterface as a side effect.

I can now use flickrapi with my Ubuntu Flickr account!

share|improve this answer
I have prepared a snippet to illustrate fully working solution:… – dargad Jul 3 '13 at 18:19

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.