Issue 29 in flickrpy: Retrieve user location of photo

1 view
Skip to first unread message

flic...@googlecode.com

unread,
Oct 23, 2014, 6:19:23 PM10/23/14
to flickrp...@googlegroups.com
Status: New
Owner: ----
Labels: Type-Defect Priority-Medium

New issue 29 by t.ha...@googlemail.com: Retrieve user location of photo
https://code.google.com/p/flickrpy/issues/detail?id=29

Hi, sorry I'm relatively new to python. I have a question regarding my
code. I'm stuck when I try to scrape the user's locations (not the
picture's locations). Here's my code:

#FLICKR API SCRIPT
from flickr import *

#PERSONAL API KEY & PASSWORD
flickr.API_KEY = '8a5710b69be295ec77a205XXXXXXXXXX'
flickr.API_SECRET = '41e94XXXXXXXXX'

#GET PHOTOS BY TAG:
photos = photos_search(tags='manhattan', pages= '2', per_page='100')
print len(photos)
print photos

#GET PHOTO LOCATION:
geolist = []
for i in photos:
if i.getLocation() != None:
geolist.append(i.getLocation())
print len(geolist)
print geolist

#GET USERS:
owners = []
for i in photos:
if i.getLocation() != None:
owners.append(i.owner)
print len(owners)
print owners

#GET USER PROPERTIES GENERAL:
ownerprop = []
for i in owners:
ownerprop.append(i._load_properties)
print len(ownerprop)
print ownerprop

#GET USER LOCATION:
ownerloc = []
for i in owners:
print i.__location

The general properties should include location of the owner, but they
return this weird object I can't perform any functions on. Here's the link
to the flickr module code:
http://flickrpy.googlecode.com/svn/trunk/flickr.py

Any ideas?

Another thing is that the page maximum of pictures is 500 and I somehow can
only pull data from 1 page, even though I set the "pages" parameter to 2,
to 'all', and few others I thought of. It never gives me error messages,
but the data is pulled for only 500 images. Of those, only about 10-30%
have geo tags, way too few to make a map...

Thanks in advance!


--
You received this message because this project is configured to send all
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

flic...@googlecode.com

unread,
Oct 24, 2014, 3:54:15 AM10/24/14
to flickrp...@googlegroups.com
Updates:
Status: Accepted
Owner: jims...@gmail.com

Comment #1 on issue 29 by jims...@gmail.com: Retrieve user location of photo
https://code.google.com/p/flickrpy/issues/detail?id=29

(No comment was entered for this change.)

flic...@googlecode.com

unread,
Dec 9, 2014, 10:51:40 AM12/9/14
to flickrp...@googlegroups.com
Updates:
Status: Fixed
Labels: -Type-Defect Type-Other Usability Component-Docs

Comment #2 on issue 29 by jims...@gmail.com: Retrieve user location of photo
https://code.google.com/p/flickrpy/issues/detail?id=29

Sorry you've had some problems getting flickr.py to work. I've put a
working version of your script here:
https://gist.github.com/jimr/69ac53457d1a42f719a1

There were only a couple of things wrong with your script. First,
appending 'i._load_properties' to 'ownerprop' was adding a function to a
list, rather than the results of calling a function. Additionally, where
you call 'i.__location', you should instead just reference 'location'.
Basically, flickr.py tries to minimise calls to the flickr API while giving
you a nice interface to work with. So, for example, it won't load all the
details of the owner of a photo unless you request, for example,
the 'location' attribute. If it's not loaded, it goes off and requests it
(calling '_load_propertoes()' in the process.

As for the pagination issue, see a working example here:
https://gist.github.com/jimr/4e122148e30fbb3d0ef5

flic...@googlecode.com

unread,
Dec 10, 2014, 12:08:03 AM12/10/14
to flickrp...@googlegroups.com

Comment #3 on issue 29 by t.ha...@googlemail.com: Retrieve user location of
photo
https://code.google.com/p/flickrpy/issues/detail?id=29

thanks for the answer! will try it out tomorrow!

flic...@googlecode.com

unread,
Dec 10, 2014, 1:55:17 PM12/10/14
to flickrp...@googlegroups.com

Comment #4 on issue 29 by jims...@gmail.com: Retrieve user location of photo
https://code.google.com/p/flickrpy/issues/detail?id=29

No worries. Sorry it took so long to get around to answering. Let us know
if you have any other questions or problems.
Reply all
Reply to author
Forward
0 new messages