本文整理汇总了Python中api.API.tags方法的典型用法代码示例。如果您正苦于以下问题:Python API.tags方法的具体用法?Python API.tags怎么用?Python API.tags使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类api.API
的用法示例。
在下文中一共展示了API.tags方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: SinaAPI
# 需要导入模块: from api import API [as 别名]
# 或者: from api.API import tags [as 别名]
#.........这里部分代码省略.........
)
def request_refresh_token(
self,
client_id,
client_secret,
refresh_token,
redirect_uri=None,
):
return _request_refresh_token(
self.client_id,
self.client_secret,
refresh_token,
self.redirect_uri,
)
@check_remain_requests('Too many requests in getCurrentUser')
def getCurrentUser(self):
"""返回当前登录用户的信息,如果未登录,返回False"""
logger.info('api-nail')
try:
status = self.api.verify_credentials()
except WeibopError:
logger.info("WeibopError")
return False
return status
@check_remain_requests('Too many requests in getTags')
def getTags(self, uid, count=20, page=None):
logger.info('api-nail')
if count > 200:
raise Exception('Too many tag counts per page.')
if page:
return self.api.tags(uid=uid, count=count, page=page)
else:
return self.api.tags(uid=uid, count=count)
def getDirectMsgs(self, since_id=None, count=200):
logger.info('api-nail')
page = 1
rvl=[]
while True:
self._testResetTime()
if self.request_limit < 1:
raise TooManyRequests('Too many requests in getDirectMsgs')
self.request_limit -= 1
if since_id:
directMsgs = self.api.direct_messages(since_id=since_id, count=count, page=page)
else:
directMsgs = self.api.direct_messages(count=count, page=page)
rvl.extend(directMsgs)
if len(directMsgs) < count:
break;
page +=1
return rvl
def getSentDirectMsgs(self, since_id=None, count=200):
logger.info('api-nail')
page = 1
rvl=[]
while True:
self._testResetTime()