def twitter_callback(fun):
    @wraps(fun)
    def inner(request, *args, **kwargs):
        token = request.GET.get('oauth_token')
        verifier = request.GET.get('oauth_verifier')

        if token is None or verifier is None:
            raise Exception("Either `token` or `verifier` must be present in the callback URL.")

        if token != request.session['temporary_oauth_token']:
            raise Exception("tokens don't match, do not move forward with authentication")

        secret = request.session['temporary_oauth_secret']
        client = twitter.Twitter(token, secret)
        data = client.oauth.access_token(oauth_verifier=verifier)

        from signals import post_twitter_auth
        post_twitter_auth.send('ecl_twitter', data=data)
        return fun(request, data, *args, **kwargs)
    return inner
Actual method to read celery settings from app configuration and initialize the celery instance.
dataset/ETHPy150Open elmcitylabs/ECL-Twitter/ecl_twitter/decorators.py/twitter_callback--crossover with--dataset/ETHPy150Open Robpol86/Flask-Celery-Helper/flask_celery.py/Celery.init_app