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


Python API.new_direct_message方法代码示例

本文整理汇总了Python中api.API.new_direct_message方法的典型用法代码示例。如果您正苦于以下问题:Python API.new_direct_message方法的具体用法?Python API.new_direct_message怎么用?Python API.new_direct_message使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在api.API的用法示例。


在下文中一共展示了API.new_direct_message方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: SinaAPI

# 需要导入模块: from api import API [as 别名]
# 或者: from api.API import new_direct_message [as 别名]

#.........这里部分代码省略.........

    @check_remain_requests('Too many requests in getComments')
    def getComments(self, status_id, count=200, page=1):
        logger.info('api-nail')
        return self.api.comments(status_id, count=count, page=page)

    @check_remain_requests('Too many requests in getComments')
    def getMentions(self, since_id, count=200, page=1):
        logger.info('api-nail')
        return self.api.mentions(since_id=since_id, count=count, page=page)


    @check_remain_requests('Too many requests in getLimitedFriendsIds')
    def getLimitedFriendsIds(self, cursor=-1, count=20):
        logger.info('api-nail')
        status = self.api.friends_ids(cursor=cursor, count=count)
        return {'ids':status.ids, 'next_cursor':status.next_cursor}
    
    @check_remain_requests('Too many requests in getUser')
    def getUser(self,user_id):
        #logger.info('api-nail')
        status = self.api.get_user(uid=user_id)
        return status

    @check_remain_requests('Too many requests in getUser')
    def getUserByName(self, screen_name=None):
        logger.info('api-nail')
        userInfo = self.api.get_user(screen_name=screen_name)
        return userInfo

    @check_remain_requests('Too many requests in sendMessage')
    def sendMessage(self,user_id,message):
        logger.info('api-nail')
        status = self.api.new_direct_message(
                    id=user_id, user_id=user_id, text=message)
        return status
    
    @check_remain_requests('Too many requests in updateStatus')
    def updateStatus(self, message):
        logger.info('api-nail')
        status = self.api.update_status(status=message)
        return status
        
    @check_remain_requests('Too many requests in destroyStatus')
    def destroyStatus(self, mid):
        logger.info('api-nail')
        status = self.api.destroy_status(mid)
        mid = self.getAttValue(status,"id")
        text = self.getAttValue(status,"text")
        return status

    @check_remain_requests('Too many requests in showFriendship')
    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')
开发者ID:seraphlnWu,项目名称:weibosdk,代码行数:70,代码来源:sinaapi.py


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