当前位置: 首页>>代码示例>>Python>>正文


Python FlickrAPI.photosets_delete方法代码示例

本文整理汇总了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']
开发者ID:Xirg,项目名称:flickrfs-old,代码行数:70,代码来源:transactions.py


注:本文中的flickrapi.FlickrAPI.photosets_delete方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。