本文整理汇总了Python中flickrapi.FlickrAPI.photos_geo_getLocation方法的典型用法代码示例。如果您正苦于以下问题:Python FlickrAPI.photos_geo_getLocation方法的具体用法?Python FlickrAPI.photos_geo_getLocation怎么用?Python FlickrAPI.photos_geo_getLocation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类flickrapi.FlickrAPI
的用法示例。
在下文中一共展示了FlickrAPI.photos_geo_getLocation方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from flickrapi import FlickrAPI [as 别名]
# 或者: from flickrapi.FlickrAPI import photos_geo_getLocation [as 别名]
#.........这里部分代码省略.........
def getGeotaggedPhotoList(self, dateLo, dateHi):
"""Returns a list of photo given a time frame"""
n = 0
flickr_max = 500
photos = []
print 'Retrieving list of photos'
while True:
if self.verbose:
print 'Requesting a page...'
n = n + 1
rsp = \
self.fapi.photos_getWithGeoData(api_key=self.__flickrAPIKey,
auth_token=self.token, user_id=self.flickrUserId,
per_page=str(flickr_max), page=str(n))
if self.__testFailure(rsp):
return None
if rsp.photos[0]['total'] == '0':
return None
photos += rsp.photos[0].photo
if self.verbose:
print ' %d photos so far' % len(photos)
if len(photos) >= int(rsp.photos[0]['total']):
break
return photos
def getPhotoLocation(self, pid):
"""Returns a string containing location of a photo (in XML)"""
rsp = \
self.fapi.photos_geo_getLocation(api_key=self.__flickrAPIKey,
auth_token=self.token, photo_id=pid)
if self.__testFailure(rsp):
return None
doc = libxml2.parseDoc(rsp.xml)
info = doc.xpathEval('/rsp/photo')[0].serialize()
doc.freeDoc()
return info
def getPhotoLocationPermission(self, pid):
"""Returns a string containing location permision for a photo (in XML)"""
rsp = \
self.fapi.photos_geo_getPerms(api_key=self.__flickrAPIKey,
auth_token=self.token, photo_id=pid)
if self.__testFailure(rsp):
return None
doc = libxml2.parseDoc(rsp.xml)
info = doc.xpathEval('/rsp/perms')[0].serialize()
doc.freeDoc()
return info
def getPhotosetList(self):
"""Returns a list of photosets for a user"""
rsp = self.fapi.photosets_getList(api_key=self.__flickrAPIKey,
auth_token=self.token, user_id=self.flickrUserId)
if self.__testFailure(rsp):
return None
return rsp.photosets[0].photoset
def getPhotosetInfo(self, pid, method):
"""Returns a string containing information about a photoset (in XML)"""