本文整理汇总了Python中Image.Image.imageIndex方法的典型用法代码示例。如果您正苦于以下问题:Python Image.imageIndex方法的具体用法?Python Image.imageIndex怎么用?Python Image.imageIndex使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Image.Image
的用法示例。
在下文中一共展示了Image.imageIndex方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Image
# 需要导入模块: from Image import Image [as 别名]
# 或者: from Image.Image import imageIndex [as 别名]
if 'results' not in json['responseData']:
response.error = 'invalid response from google while searching "%s":\n%s' \
% (search_text, response)
response.retryableError = False
return response
from Image import Image
images = []
for (current_index, json_image) in enumerate(json['responseData']['results']):
imageUrl = json_image['unescapedUrl']
meta = httpy.get_meta(imageUrl, timeout=5)
if 'Content-type' not in meta or 'image' not in meta['Content-Type']:
# Image is not an image.
continue
try:
image = Image(json=json_image)
image.imageIndex = start_index + current_index + 1
images.append(image)
except Exception, e:
# Don't fail completely when deserializing single images
pass
response.images = images
return response
if __name__ == '__main__':
response = Google.searchImages("butterfly", 0)
for image in response.images:
print image.toJSON()
from FS import FS
FS.saveSummaryOfImages(response.images, 'butterfly', response.exhausted, len(response.images))