本文整理汇总了Python中twitdao.Twitdao.users_show_by_screen_name方法的典型用法代码示例。如果您正苦于以下问题:Python Twitdao.users_show_by_screen_name方法的具体用法?Python Twitdao.users_show_by_screen_name怎么用?Python Twitdao.users_show_by_screen_name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类twitdao.Twitdao
的用法示例。
在下文中一共展示了Twitdao.users_show_by_screen_name方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get
# 需要导入模块: from twitdao import Twitdao [as 别名]
# 或者: from twitdao.Twitdao import users_show_by_screen_name [as 别名]
def get(self, screen_name, slug):
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)
self.render(
"list-timeline.html",
{
"token": token,
"token_user": token_user,
"owner_user": owner_user,
"list": ls,
"timeline": timeline,
"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,
"where": "list-timeline",
},
)
示例2: get
# 需要导入模块: from twitdao import Twitdao [as 别名]
# 或者: from twitdao.Twitdao import users_show_by_screen_name [as 别名]
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))
}))
示例3: get
# 需要导入模块: from twitdao import Twitdao [as 别名]
# 或者: from twitdao.Twitdao import users_show_by_screen_name [as 别名]
def get(self, screen_name):
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
block_user = td.users_show_by_screen_name(screen_name=screen_name)
self.render(
"mobile/unblock.html",
{"token": token, "token_user": token_user, "owner_user": owner_user, "user": block_user},
)
示例4: get
# 需要导入模块: from twitdao import Twitdao [as 别名]
# 或者: from twitdao.Twitdao import users_show_by_screen_name [as 别名]
def get(self):
tk = self.param('tk')
screen_name = self.param('screen_name')
user_id = self.param('user_id')
params={'_twitdao_force_refresh':True}
include_entities = self.param('include_entities')
if include_entities:
params.update({'include_entities':include_entities})
token = md.get_access_token(tk)
td = Twitdao(token)
user = None
if user_id:
user=td.users_show_by_id(user_id=user_id, **params)
elif screen_name:
user=td.users_show_by_screen_name(screen_name=screen_name, **params)
logging.debug(user)
if 'X-AppEngine-QueueName' not in self.request.headers:
self.write(repr(user))
示例5: get
# 需要导入模块: from twitdao import Twitdao [as 别名]
# 或者: from twitdao.Twitdao import users_show_by_screen_name [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',
})
示例6: get
# 需要导入模块: from twitdao import Twitdao [as 别名]
# 或者: from twitdao.Twitdao import users_show_by_screen_name [as 别名]
def get(self, screen_name, slug):
params = self.params([
'user_id',
'since_id',
'max_id',
'count',
'page',
'trim_user',
'include_rts',
'include_entities',
],include_rts='true')
token = md.get_proxy_access_token()
#if not token:
# token = md.get_proxy_access_token()
if not token:
self.write(json.dumps({
'success':False,
'info':'No access token avaliable.',
}))
return
td = Twitdao(token)
owner_user = td.users_show_by_screen_name( screen_name=screen_name, **params)
token_user = td.users_show_by_id(user_id = token.user_id)
timeline = td.user_timeline(screen_name=screen_name, **params)
tweets = self.render('ajax/user-user.html', {
'token':token,
#'token_user':token_user,
'owner_user':owner_user,
'timeline':timeline,
},out=False)
if slug == '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':'/user/%s?%s' % (screen_name, urlencode(next_params))
}))