本文整理汇总了Python中twitdao.Twitdao.direct_messages方法的典型用法代码示例。如果您正苦于以下问题:Python Twitdao.direct_messages方法的具体用法?Python Twitdao.direct_messages怎么用?Python Twitdao.direct_messages使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类twitdao.Twitdao
的用法示例。
在下文中一共展示了Twitdao.direct_messages方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get
# 需要导入模块: from twitdao import Twitdao [as 别名]
# 或者: from twitdao.Twitdao import direct_messages [as 别名]
def get(self):
params = self.params(["since_id", "max_id", "count", "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 = token_user
direct_messages = td.direct_messages(**params)
self.render(
"messages.html",
{
"token": token,
"token_user": token_user,
"owner_user": owner_user,
"max_id": str(direct_messages[-1]["id"] - 1)
if type(direct_messages) == list and len(direct_messages) > 0
else None,
"since_id": direct_messages[0]["id_str"]
if type(direct_messages) == list and len(direct_messages) > 0
else None,
"messages": direct_messages,
"where": "inbox",
},
)