當前位置: 首頁>>代碼示例>>Python>>正文


Python FlickrAPI.walk方法代碼示例

本文整理匯總了Python中flickrapi.FlickrAPI.walk方法的典型用法代碼示例。如果您正苦於以下問題:Python FlickrAPI.walk方法的具體用法?Python FlickrAPI.walk怎麽用?Python FlickrAPI.walk使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在flickrapi.FlickrAPI的用法示例。


在下文中一共展示了FlickrAPI.walk方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: sleep

# 需要導入模塊: from flickrapi import FlickrAPI [as 別名]
# 或者: from flickrapi.FlickrAPI import walk [as 別名]
                    start=min_date,
                    end=max_date,
                ),
                end=""
            )

            success = False

            while not success:
                sleep(2)
                try:
                
                    # iterator over search results
                    walker = api.walk(
                        min_taken_date=min_date,
                        max_taken_date=max_date,
                        **search_args
                    )

                    # collect results
                    data = [convert_values(elem) + get_size(elem)
                            for elem in walker]

                except KeyboardInterrupt as e:
                    raise KeyboardInterrupt(e)
                except:
                    sys.stderr.write("failed, trying again...\n")
                else:
                    success = True
                    csv_writer.writerows(data)
                    print("fetched {n} photos".format(n=len(data)))
開發者ID:mcwitt,項目名稱:scenicstroll,代碼行數:33,代碼來源:flickr_getter.py

示例2: FlickrAPI

# 需要導入模塊: from flickrapi import FlickrAPI [as 別名]
# 或者: from flickrapi.FlickrAPI import walk [as 別名]
from flickrapi import FlickrAPI, shorturl
import urllib
API_KEY= '334cf7234def6ecea68c28886e7926f9'

SECRET = '3afd55d06e53ac92'

flickr = FlickrAPI(API_KEY, SECRET)

if __name__ == '__main__':

    favs = flickr.walk(tags="skin lesion", per_page="1500")
    dest_dir = 'images/'


    for i, photo in enumerate(favs):
            title= photo.get('title')
            ident = photo.get('id')
            local = '%s%s_.jpg'%(dest_dir,title)

            farm = photo.get('farm')
            server = photo.get('server')
            secret = photo.get('secret')
            
            try: 
                prefix = "http://farm" + farm + ".staticflickr.com/"+server+"/"
                suffix = ident + "_"+secret+"_b.jpg"
                
                url = prefix + suffix

                urllib.urlretrieve(url, local)
            except:
開發者ID:gatech-cse6242,項目名稱:scraping,代碼行數:33,代碼來源:flickr_scraper.py


注:本文中的flickrapi.FlickrAPI.walk方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。