本文整理匯總了Python中flickrapi.FlickrAPI.photosets_delete方法的典型用法代碼示例。如果您正苦於以下問題:Python FlickrAPI.photosets_delete方法的具體用法?Python FlickrAPI.photosets_delete怎麽用?Python FlickrAPI.photosets_delete使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類flickrapi.FlickrAPI
的用法示例。
在下文中一共展示了FlickrAPI.photosets_delete方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: __init__
# 需要導入模塊: from flickrapi import FlickrAPI [as 別名]
# 或者: from flickrapi.FlickrAPI import photosets_delete [as 別名]
#.........這裏部分代碼省略.........
log.error("giving up; upload of %s appears to have failed", filepath)
return None
else:
id = rsp.photoid[0].elementText
log.info("file %s uploaded with photoid %s", filepath, id)
return id
def put2Set(self, set_id, photo_id):
log.info("uploading photo %s to set id %s", photo_id, set_id)
rsp = self.fapi.photosets_addPhoto(auth_token=self.authtoken,
photoset_id=set_id, photo_id=photo_id)
if rsp:
log.info("photo uploaded to set")
else:
log.error(rsp.errormsg)
def createSet(self, path, photo_id):
log.info("creating set %s with primary photo %s", path, photo_id)
path, title = os.path.split(path)
rsp = self.fapi.photosets_create(auth_token=self.authtoken,
title=title, primary_photo_id=photo_id)
if rsp:
log.info("created set %s", title)
return rsp.photoset[0]['id']
else:
log.error(rsp.errormsg)
def deleteSet(self, set_id):
log.info("deleting set %s", set_id)
if str(set_id)=="0":
log.info("ignoring attempt to delete set wtih set_id 0 (a locally "
"created set that has not yet acquired an id via uploading")
return
rsp = self.fapi.photosets_delete(auth_token=self.authtoken,
photoset_id=set_id)
if rsp:
log.info("deleted set %s", set_id)
else:
log.error(rsp.errormsg)
def getPhotoInfo(self, photoId):
log.debug("id: %s", photoId)
rsp = self.fapi.photos_getInfo(auth_token=self.authtoken, photo_id=photoId)
if not rsp:
log.error("can't retrieve information about photo %s; got error %s",
photoId, rsp.errormsg)
return None
#XXX: should see if there's some other 'format' option we can fall back to.
try: format = rsp.photo[0]['originalformat']
except KeyError: format = 'jpg'
perm_public = rsp.photo[0].visibility[0]['ispublic']
perm_family = rsp.photo[0].visibility[0]['isfamily']
perm_friend = rsp.photo[0].visibility[0]['isfriend']
if perm_public == '1':
mode = 0755
else:
b_cnt = 4
if perm_family == '1':
b_cnt += 2
if perm_friend == '1':
b_cnt += 1
mode = "07" + str(b_cnt) + "4"
mode = int(mode)
if hasattr(rsp.photo[0],'permissions'):
permcomment = rsp.photo[0].permissions[0]['permcomment']