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


Python md.get_default_access_token函数代码示例

本文整理汇总了Python中md.get_default_access_token函数的典型用法代码示例。如果您正苦于以下问题:Python get_default_access_token函数的具体用法?Python get_default_access_token怎么用?Python get_default_access_token使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: post

    def post(self, id):
        params = self.params(['include_entities'])
        
        token = md.get_default_access_token()
        if not token:
            self.write(json.dumps({
                'success':False,
                'info':'No access token avaliable.',
            }))
            return
        
        td = Twitdao(token)
        message = td.direct_messages_destroy(id=id, **params)

        if 'error' in message:
            self.write(json.dumps({
                'success':False,
                'info':message['error'],
            }))
        else:
            self.write(json.dumps({
                'success':True,
                'info':'OK',
                'message':message,
            }))
开发者ID:messiahxu,项目名称:Twitdao11,代码行数:25,代码来源:ajax.py

示例2: get

    def get(self, screen_name, slug, xlug):
        
        params = self.params(['since_id','max_id','per_page','page','include_entities'])

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

        td = Twitdao(token)
        token_user = td.users_show_by_id(user_id = token.user_id)
        owner_user = td.users_show_by_screen_name(screen_name = screen_name)
        #ls = td.user_list_id_get(id=slug, screen_name=screen_name)
        timeline = td.user_list_id_statuses(id=slug, screen_name = screen_name, **params)

        tweets=self.render('ajax/list.html', {
            'token':token,
            'token_user':token_user,
            'owner_user':owner_user,
            #'list':ls,
            'timeline':timeline,
        },out=False)

        if xlug == 'refresh':
            next_params={}
            count=0
            if type(timeline) == list and len(timeline):
                next_params['since_id'] = str(timeline[0]['id'])
                count = len(timeline)
            else:
                tweets=''
                next_params['since_id'] = str(params['since_id'])
                count = 0

            self.write(json.dumps({
                'success':True,
                'info':'OK',
                'tweets':tweets,
                'params':next_params,
                'count':count,
            }))
        else:
            next_params={}
            count=0
            if type(timeline) == list and len(timeline):
                next_params['max_id'] = str(timeline[-1]['id']-1)
                count = len(timeline)
            else:
                tweets=''
                next_params['max_id'] = str(params['max_id'])
                count = 0

            self.write(json.dumps({
                'success':True,
                'info':'OK',
                'tweets':tweets,
                'params':next_params,
                'count':count,
                'href':'/t/%s/%s?%s'% (screen_name, slug, urlencode(next_params))
            }))
开发者ID:messiahxu,项目名称:Twitdao11,代码行数:60,代码来源:ajax.py

示例3: get

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

        params = self.params(["page", "include_entities"])
        page = self.param("page")

        td = Twitdao(token)
        token_user = td.users_show_by_id(user_id=token.user_id)
        owner_user = token_user
        blocking = td.blocks_blocking(**params)

        prev_page, next_page = None, 2
        if page:
            try:
                page = int(page)
                prev_page = page - 1 if page - 1 > 0 else None
                next_page = page + 1
            except:
                pass

        self.render(
            "blocking.html",
            {
                "token_user": token_user,
                "owner_user": owner_user,
                "blocking": blocking,
                "prev_page": prev_page,
                "next_page": next_page,
            },
        )
开发者ID:tongsu,项目名称:twitdao,代码行数:33,代码来源:main.py

示例4: get

    def get(self, id):
        params = self.params(['trim_user','include_entities'])

        token = md.get_default_access_token()
        if not token:
            self.write(json.dumps({
                'success':False,
                'info':'No access token avaliable.',
            }))
            return

        td = Twitdao(token)
        token_user = td.users_show_by_id(user_id = token.user_id)
        tweet = td.statuses_show(id=id, **params)
        tweet_html = self.render('ajax/user-tweet.html', {
            'token':token,
            #'token_user':token_user,
            'tweet':tweet,
        }, out=False)

        self.write(json.dumps({
            'tweet':tweet_html if 'error' not in tweet else None,
            'success':'error' not in tweet,
            'info':tweet['error'] if 'error' in tweet else 'OK',
        }))
开发者ID:messiahxu,项目名称:Twitdao11,代码行数:25,代码来源:ajax1.py

示例5: get

 def get(self):
     token = md.get_default_access_token()
     if not token:
         self.redirect("/settings")
         return
     td = Twitdao(token)
     token_user = td.users_show_by_id(user_id=token.user_id)
     owner_user = token_user
     self.render("mobile/upload.html", {"token": token, "token_user": token_user, "owner_user": owner_user})
开发者ID:tongsu,项目名称:twitdao,代码行数:9,代码来源:mobile.py

示例6: post

    def post(self, lid):

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

        td = Twitdao(token)
        lst = td.user_list_id_delete(id=lid)
        self.redirect("/t/%s/lists" % token.screen_name)
开发者ID:tongsu,项目名称:twitdao,代码行数:10,代码来源:main.py

示例7: get

    def get(self):
        cursor=self.param('cursor', default_value=None)
        default_token = md.get_default_access_token()
        tokens, cursor = md.get_user_access_tokens(users.get_current_user(), 10, cursor)

        self.render('settings.html', {
            'default_token':default_token,
            'tokens':tokens,
            'cursor':cursor,
            'where':'settings'
        })
开发者ID:messiahxu,项目名称:Twitdao11,代码行数:11,代码来源:settings.py


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