本文整理汇总了Python中api.API.upload方法的典型用法代码示例。如果您正苦于以下问题:Python API.upload方法的具体用法?Python API.upload怎么用?Python API.upload使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类api.API
的用法示例。
在下文中一共展示了API.upload方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: SinaAPI
# 需要导入模块: from api import API [as 别名]
# 或者: from api.API import upload [as 别名]
#.........这里部分代码省略.........
def showFriendship(self, src_id, target_id):
logger.info('api-nail')
src, target = self.api.show_friendship(source_id=src_id, target_id=target_id)
return src, target
@check_remain_requests('Too many requests in ifFollowedBy')
def ifFollowedBy(self, target_id):
logger.info('api-nail')
src, target = self.api.show_friendship(target_id=target_id)
return src.followed_by
@check_remain_requests('Too many requests in comment')
def comment(self, comment, mid, cid=None):
logger.info('api-nail')
status = self.api.comment(id=mid, comment=comment, comment_ori=0)
ncid = self.getAttValue(status,"id")
text = self.getAttValue(status,"text")
return ncid
@check_remain_requests('Too many requests in comment')
def reply(self, comment, sid, cid):
logger.info('api-nail')
status = self.api.reply(id=sid,cid=cid,comment=comment, without_mention=True)
ncid = self.getAttValue(status,"id")
text = self.getAttValue(status,"text")
return ncid
@check_remain_requests('Too many requests in commentDestroy')
def commentDestroy(self, cid):
status = self.api.comment_destroy(cid)
ncid = self.getAttValue(status,"id")
text = self.getAttValue(status,"text")
@check_remain_requests('Too many requests in uploadResult')
def uploadResult(self, contents, status,contenttype="image/png"):
logger.info('api-nail')
status = self.api.upload_result(contents, status,contenttype=contenttype)
ncid = self.getAttValue(status, "id")
text = self.getAttValue(status, "text")
return status
@check_remain_requests('Too many requests in upload')
def upload(self, filename, status):
logger.info('api-nail')
status = self.api.upload(filename, status)
ncid = self.getAttValue(status, "id")
text = self.getAttValue(status, "text")
@check_remain_requests('Too many requests in createFriendship')
def createFriendship(self,user_id):
logger.info('api-nail')
user = self.api.create_friendship(user_id=user_id)
return user
@check_remain_requests('Too many requests in destoryFriendship')
def destroyFriendship(self,user_id):
logger.info('api-nail')
user = self.api.destroy_friendship(user_id=user_id)
return user
def getRateLimit(self):
logger.info('api-nail')
return self.api.rate_limit_status()
@check_remain_requests('Too many requests in destoryFriendship')