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


Python Twitdao.friendships_show方法代码示例

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


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

示例1: get

# 需要导入模块: from twitdao import Twitdao [as 别名]
# 或者: from twitdao.Twitdao import friendships_show [as 别名]
    def get(self, screen_name):

        params = self.params(
            ["user_id", "since_id", "max_id", "count", "page", "trim_user", "include_rts", "include_entities"],
            include_rts="true",
        )

        token = md.get_default_access_token()
        if not token:
            self.redirect("/settings")
            return

        td = Twitdao(token)
        owner_user = td.users_show_by_screen_name(screen_name=screen_name)
        token_user = td.users_show_by_id(user_id=token.user_id)
        friendship = td.friendships_show(source_id=token.user_id, target_screen_name=screen_name)
        timeline = td.user_timeline(screen_name=screen_name, **params)

        self.render(
            "user-timeline.html",
            {
                "token": token,
                "token_user": token_user,
                "owner_user": owner_user,
                "max_id": str(timeline[-1]["id"] - 1) if type(timeline) == list and len(timeline) > 0 else None,
                "since_id": timeline[0]["id_str"] if type(timeline) == list and len(timeline) > 0 else None,
                "timeline": timeline,
                "friendship": friendship,
                "where": "user",
            },
        )
开发者ID:tongsu,项目名称:twitdao,代码行数:33,代码来源:main.py

示例2: get

# 需要导入模块: from twitdao import Twitdao [as 别名]
# 或者: from twitdao.Twitdao import friendships_show [as 别名]
    def get(self, screen_name):

        params = self.params([
            'user_id',
            'since_id',
            'max_id',
            'count',
            'page',
            'trim_user',
            'include_rts',
            'include_entities',
        ],include_rts='true')
        #if screen_name== '':
        #    self.redirect('/')
        #    return
        token = md.get_proxy_access_token()
        #if not token:
        #    self.redirect('/')
        #    return

        td = Twitdao(token)
        owner_user = td.users_show_by_screen_name( screen_name=screen_name )
        token_user = td.users_show_by_id(user_id = token.user_id)
        friendship = td.friendships_show(source_id=token.user_id, target_screen_name=screen_name)
        timeline = td.user_timeline(screen_name=screen_name, **params)


        self.render('user-timeline-proxy.html', {
            'token':token,
            #'token_user':'twittertwitter',#  token_user
            'owner_user':owner_user,
            'max_id':str(timeline[-1]['id']-1) if type(timeline)==list and len(timeline)>0 else None,
            'since_id':timeline[0]['id_str'] if type(timeline)==list and len(timeline)>0 else None,
            'timeline':timeline,
            #'friendship':friendship,
            'where':'user',
        })
开发者ID:messiahxu,项目名称:Twitdao11,代码行数:39,代码来源:user.py


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