本文整理汇总了Python中sanction.client.Client.auth_uri方法的典型用法代码示例。如果您正苦于以下问题:Python Client.auth_uri方法的具体用法?Python Client.auth_uri怎么用?Python Client.auth_uri使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sanction.client.Client
的用法示例。
在下文中一共展示了Client.auth_uri方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: handle_github
# 需要导入模块: from sanction.client import Client [as 别名]
# 或者: from sanction.client.Client import auth_uri [as 别名]
def handle_github(self, data):
self.send_response(302)
c = Client(auth_endpoint='https://github.com/login/oauth/authorize',
client_id=config['github.client_id'],
redirect_uri='http://localhost/login/github')
self.send_header('Location', c.auth_uri())
self.end_headers()
示例2: handle_foursquare
# 需要导入模块: from sanction.client import Client [as 别名]
# 或者: from sanction.client.Client import auth_uri [as 别名]
def handle_foursquare(self, data):
self.send_response(302)
c = Client(auth_endpoint='https://foursquare.com/oauth2/authenticate',
client_id=config['foursquare.client_id'],
redirect_uri='http://localhost/login/foursquare')
self.send_header('Location', c.auth_uri())
self.end_headers()
示例3: handle_stackexchange
# 需要导入模块: from sanction.client import Client [as 别名]
# 或者: from sanction.client.Client import auth_uri [as 别名]
def handle_stackexchange(self, data):
self.send_response(302)
c = Client(auth_endpoint="https://stackexchange.com/oauth",
client_id=config["stackexchange.client_id"],
redirect_uri="http://localhost/login/stackexchange")
self.send_header("Location", c.auth_uri())
self.end_headers()
示例4: handle_instagram
# 需要导入模块: from sanction.client import Client [as 别名]
# 或者: from sanction.client.Client import auth_uri [as 别名]
def handle_instagram(self, data):
self.send_response(302)
c = Client(auth_endpoint='https://api.instagram.com/oauth/authorize/',
client_id=config['instagram.client_id'],
redirect_uri='http://localhost/login/instagram')
self.send_header('Location', c.auth_uri())
self.end_headers()
示例5: handle_instagram
# 需要导入模块: from sanction.client import Client [as 别名]
# 或者: from sanction.client.Client import auth_uri [as 别名]
def handle_instagram(self, data):
self.send_response(302)
c = Client(auth_endpoint="https://api.instagram.com/oauth/authorize/",
client_id=config["instagram.client_id"],
redirect_uri="http://localhost:8080/login/instagram")
self.send_header("Location", c.auth_uri())
self.end_headers()
示例6: handle_bitly
# 需要导入模块: from sanction.client import Client [as 别名]
# 或者: from sanction.client.Client import auth_uri [as 别名]
def handle_bitly(self, data):
self.send_response(302)
c = Client(auth_endpoint="https://bitly.com/oauth/authorize",
client_id=config["bitly.client_id"],
redirect_uri="http://localhost:8080/login/bitly")
self.send_header("Location", c.auth_uri())
self.end_headers()
示例7: handle_foursquare
# 需要导入模块: from sanction.client import Client [as 别名]
# 或者: from sanction.client.Client import auth_uri [as 别名]
def handle_foursquare(self, data):
self.send_response(302)
c = Client(auth_endpoint="https://foursquare.com/oauth2/authenticate",
client_id=config["foursquare.client_id"],
redirect_uri="http://localhost:8080/login/foursquare")
self.send_header("Location", c.auth_uri())
self.end_headers()
示例8: handle_google
# 需要导入模块: from sanction.client import Client [as 别名]
# 或者: from sanction.client.Client import auth_uri [as 别名]
def handle_google(self, data):
self.send_response(302)
c = Client(auth_endpoint="https://accounts.google.com/o/oauth2/auth",
client_id=config["google.client_id"],
redirect_uri="http://localhost/login/google")
self.send_header("Location", c.auth_uri(
scope=config["google.scope"].split(","), access_type="offline"))
self.end_headers()
示例9: handle_deviantart
# 需要导入模块: from sanction.client import Client [as 别名]
# 或者: from sanction.client.Client import auth_uri [as 别名]
def handle_deviantart(self, data):
self.send_response(302)
c = Client(
auth_endpoint='https://www.deviantart.com/oauth2/draft15/authorize',
client_id=config['deviantart.client_id'],
redirect_uri=config['deviantart.redirect_uri'])
self.send_header('Location', c.auth_uri())
self.end_headers()
示例10: handle_facebook
# 需要导入模块: from sanction.client import Client [as 别名]
# 或者: from sanction.client.Client import auth_uri [as 别名]
def handle_facebook(self, data):
self.send_response(302)
c = Client(auth_endpoint='https://www.facebook.com/dialog/oauth',
client_id=config['facebook.client_id'],
redirect_uri='http://localhost/login/facebook')
self.send_header('Location', c.auth_uri(
scope=config['facebook.scope'].split(','),
scope_delim=','))
self.end_headers()
示例11: get_oauth2_starter_url
# 需要导入模块: from sanction.client import Client [as 别名]
# 或者: from sanction.client.Client import auth_uri [as 别名]
def get_oauth2_starter_url(provider_name, csrf_token):
"""returns redirect url for the oauth2 protocol for a given provider"""
from sanction.client import Client
providers = get_enabled_login_providers()
params = providers[provider_name]
client_id = getattr(askbot_settings, provider_name.replace("-", "_").upper() + "_KEY")
redirect_uri = site_url(reverse("user_complete_oauth2_signin"))
client = Client(auth_endpoint=params["auth_endpoint"], client_id=client_id, redirect_uri=redirect_uri)
return client.auth_uri(state=csrf_token, **params.get("extra_auth_params", {}))
示例12: test_get_auth_uri
# 需要导入模块: from sanction.client import Client [as 别名]
# 或者: from sanction.client.Client import auth_uri [as 别名]
def test_get_auth_uri(self):
c = Client(auth_endpoint = auth_endpoint,
client_id = client_id)
uri = c.auth_uri()
o = urlparse(uri)
self.assertEquals(o.netloc, "example.com")
d = dict(parse_qsl(o.query))
self.assertEquals(d["response_type"], "code")
self.assertEquals(d["client_id"], client_id)
示例13: get_oauth2_starter_url
# 需要导入模块: from sanction.client import Client [as 别名]
# 或者: from sanction.client.Client import auth_uri [as 别名]
def get_oauth2_starter_url(provider_name):
"""returns redirect url for the oauth2 protocol for a given provider"""
from sanction.client import Client
providers = get_enabled_login_providers()
params = providers[provider_name]
client_id = getattr(askbot_settings, provider_name.upper() + '_KEY')
redirect_uri = askbot_settings.APP_URL + reverse('user_complete_oauth2_signin')
client = Client(
auth_endpoint=params['auth_endpoint'],
client_id=client_id,
redirect_uri=redirect_uri
)
return client.auth_uri()
示例14: get_oauth2_starter_url
# 需要导入模块: from sanction.client import Client [as 别名]
# 或者: from sanction.client.Client import auth_uri [as 别名]
def get_oauth2_starter_url(provider_name, csrf_token):
"""returns redirect url for the oauth2 protocol for a given provider"""
from sanction.client import Client
providers = get_enabled_login_providers()
params = providers[provider_name]
client_id = getattr(askbot_settings, format_setting_name(provider_name) + '_KEY')
redirect_uri = site_url(reverse('user_complete_oauth2_signin'))
client = Client(
auth_endpoint=params['auth_endpoint'],
client_id=client_id,
redirect_uri=redirect_uri
)
return client.auth_uri(state=csrf_token, **params.get('extra_auth_params', {}))
示例15: get_oauth2_starter_url
# 需要导入模块: from sanction.client import Client [as 别名]
# 或者: from sanction.client.Client import auth_uri [as 别名]
def get_oauth2_starter_url(provider_name, csrf_token):
"""returns redirect url for the oauth2 protocol for a given provider"""
from sanction.client import Client
providers = get_enabled_login_providers()
params = providers[provider_name]
client_id = getattr(askbot_settings, provider_name.upper() + '_KEY')
redirect_uri = site_url(reverse('user_complete_oauth2_signin'))
#qq = redirect_uri.split(':')
#nurl = qq[0]+':'+qq[1]+qq[2][qq[2].find('/'):]
#redirect_uri=nurl
client = Client(
auth_endpoint=params['auth_endpoint'],
client_id=client_id,
redirect_uri=redirect_uri
)
return client.auth_uri(state=csrf_token)