Question

I am trying to get some photos using :

http://www.flickr.com/services/api/flickr.photos.search.html having both the tags:

"abc" and "def" using the following code:

import flickr.py
photos = flickr.photos_search(tags= ["abc", "def"], tag_mode = all, per_page=10)

but it's returning photos with the OR condition, the tag_mode = all condition is not working

Thank you,

Was it helpful?

Solution

It seems like the method in the flickr.py will use

tag_mode=%3Cbuilt-in+function+all%3E

making the API not recognized and use the default any method

The root cause should be inside this function:

def _doget(method, auth=False, **params):

due to the use of all which is a keyword in python, urlencode(all) will convert it to %3Cbuilt-in+function+all%3E

So the solution to your problem is to change

photos = flickr.photos_search(tags= ["abc", "def"], tag_mode = all, per_page=10)

to

photos = flickr.photos_search(tags= ['abc', 'def'], tag_mode = 'all', per_page=10)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top