本文整理汇总了Python中api.API.trends_statuses方法的典型用法代码示例。如果您正苦于以下问题:Python API.trends_statuses方法的具体用法?Python API.trends_statuses怎么用?Python API.trends_statuses使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类api.API
的用法示例。
在下文中一共展示了API.trends_statuses方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: SinaAPI
# 需要导入模块: from api import API [as 别名]
# 或者: from api.API import trends_statuses [as 别名]
#.........这里部分代码省略.........
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')
def getTrendsStatus(self, trend, province=0, count=200, page=1):
status = self.api.trends_statuses(
trend=trend,
count=count,
page=page
)
return status
@check_remain_requests('Too many requests in destoryFriendship')
def ShowStatus(self, sid):
logger.info('api-nail')
return self.api.statuses_show(id=sid)
def getSearchStatus(self, q, since_id=-1):
rst_list = []
for i in range(30):
try:
status = self.api.search(q, since_id=since_id)
except Exception as e:
return rst_list
rst_list.extend(status)
since_id = status[-1]
return rst_list
def getSearchUser(self, q, page=1):
rst_list = []
for i in range(1, 10):
try:
status = self.api.search_user(q, page=i)
except Exception as e:
return rst_list
rst_list.extend(status)
return rst_list
def get_short_url_share_counts(
self,
url_short,
):
return self.api.short_url_share_counts(url_short=url_short)