本文整理汇总了Python中twitdao.Twitdao.users_show_by_id方法的典型用法代码示例。如果您正苦于以下问题:Python Twitdao.users_show_by_id方法的具体用法?Python Twitdao.users_show_by_id怎么用?Python Twitdao.users_show_by_id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类twitdao.Twitdao
的用法示例。
在下文中一共展示了Twitdao.users_show_by_id方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get
# 需要导入模块: from twitdao import Twitdao [as 别名]
# 或者: from twitdao.Twitdao import users_show_by_id [as 别名]
def get(self):
screen_name = self.param("screen_name")
status_id = self.param("status_id")
params = self.params(["trim_user", "include_entities"])
token = md.get_default_access_token()
if not token:
self.redirect("/settings")
return
if screen_name:
td = Twitdao(token)
token_user = td.users_show_by_id(user_id=token.user_id)
owner_user = token_user
self.render(
"reply.html",
{"token": token, "token_user": token_user, "owner_user": owner_user, "screen_name": screen_name},
)
else:
td = Twitdao(token)
token_user = td.users_show_by_id(user_id=token.user_id)
owner_user = token_user
tweet = td.statuses_show(id=status_id, **params)
self.render(
"reply.html", {"token": token, "token_user": token_user, "owner_user": owner_user, "tweet": tweet}
)
示例2: get
# 需要导入模块: from twitdao import Twitdao [as 别名]
# 或者: from twitdao.Twitdao import users_show_by_id [as 别名]
def get(self):
user_id = self.param('user_id')
token = md.get_default_access_token()
if not token:
self.write(json.dumps({
'success':False,
'info':'Token error.'
}))
return
td = Twitdao(token)
token_user = td.users_show_by_id(user_id = token.user_id)
owner_user = token_user
res=td.hacked_follows_in_common_with(user_id)
tweets=self.render('ajax/follows_in_common_with.html', {
'token':token,
'token_user':token_user,
'owner_user':owner_user,
'res':res,
},out=False)
self.write(json.dumps({
'success':True,
'info':'OK',
'html':tweets,
}))
示例3: get
# 需要导入模块: from twitdao import Twitdao [as 别名]
# 或者: from twitdao.Twitdao import users_show_by_id [as 别名]
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',
}))
示例4: get
# 需要导入模块: from twitdao import Twitdao [as 别名]
# 或者: from twitdao.Twitdao import users_show_by_id [as 别名]
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})
示例5: post
# 需要导入模块: from twitdao import Twitdao [as 别名]
# 或者: from twitdao.Twitdao import users_show_by_id [as 别名]
def post(self):
name = self.param("name")
params = self.params(["mode", "description"], mode="public")
name = name.encode("utf-8")
if "description" in params:
params["description"] = params["description"].encode("utf-8")
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)
lst = td.user_lists_post(name=name, **params)
self.redirect("/t/%s/%s" % (token_user["screen_name"], urllib.quote(lst["slug"].encode("utf-8"))))