本文整理汇总了Python中sanction.client.Client.expires方法的典型用法代码示例。如果您正苦于以下问题:Python Client.expires方法的具体用法?Python Client.expires怎么用?Python Client.expires使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sanction.client.Client
的用法示例。
在下文中一共展示了Client.expires方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: process_request
# 需要导入模块: from sanction.client import Client [as 别名]
# 或者: from sanction.client.Client import expires [as 别名]
def process_request(self, request):
if not request.user.is_anonymous():
try:
provider = filter(lambda p: p["name"] == request.user.provider_key,
(settings.OAUTH2_PROVIDERS[k] for k in
settings.OAUTH2_PROVIDERS))[-1]
c = Client(token_endpoint=provider["token_endpoint"],
resource_endpoint=provider["resource_endpoint"],
auth_endpoint=provider["auth_endpoint"],
redirect_uri=provider.get("redirect_uri", None),
client_id=provider["client_id"],
client_secret=provider["client_secret"])
c.access_token = request.user.access_token
c.expires = request.user.expires
setattr(request.user, "resource", c)
# play nice with other authentication backends
except IndexError:
raise KeyError("Provider %s doesn't exist" %
request.user.provider_key)
except AttributeError:
# current user isn't a django_sanction user
pass