Did I find the right examples for you? yes no

All Samples(15)  |  Call(13)  |  Derive(0)  |  Import(2)

        def app_setting(name):
    return getattr(global_settings, global_prefix+name, defaults.get(name))
        


src/d/j/django-admin-oauth2-0.2.1/oauthadmin/views.py   django-admin-oauth2(Download)
 
from oauthadmin.utils import import_by_path
from oauthadmin.settings import app_setting
 
 
def login(request):
    oauth = OAuth2Session(
        client_id=app_setting('CLIENT_ID'),
        redirect_uri=request.build_absolute_uri(reverse('oauthadmin.views.callback')),
        scope=["default"],
    )
    authorization_url, state = oauth.authorization_url(app_setting('AUTH_URL'))
def callback(request):
    oauth = OAuth2Session(app_setting('CLIENT_ID'), state=request.session['oauth_state'])
    token = oauth.fetch_token(
        app_setting('TOKEN_URL'),
        client_secret=app_setting('CLIENT_SECRET'),

src/d/j/django-admin-oauth2-0.2.1/oauthadmin/middleware.py   django-admin-oauth2(Download)
from time import time
from oauthadmin.utils import import_by_path
from oauthadmin.settings import app_setting
from oauthadmin.views import destroy_session
 
            request._cached_user = request.session['user']
 
            if app_setting('PING_INTERVAL') and app_setting('PING'):
                _verify_ping_interval(
                    request,
                    app_setting('PING_INTERVAL'),
                    import_by_path(app_setting('PING'))