@oauth_authorized.connect
def redirect_to_docs(blueprint, token):
    blueprint.token = token
    user = []
    git_hash = []
    resp = github.get('/user')
    user = User.query.filter_by(username=resp.json()['login']).first()
    if (not user):
        user = User(username=resp.json()['login'], github_hash=str(random.getrandbits(128)))
        db.session.add(user)
        db.session.commit()
        DiscordWebhook(url=discord_url, content=f"New user: {resp.json()['login']}. Check out profile at https://github.com/{resp.json()['login']}").execute()
    git_hash = user.github_hash
    return redirect(f"/docs?username={resp.json()['login']}&token={git_hash}")
@oauth_authorized.connect
def redirect_to_docs(blueprint, token):
    blueprint.token = token
    user = []
    git_hash = []
    resp = github.get('/user')
    user = User.query.filter_by(username=resp.json()['login']).first()
    if (not user):
        user = User(username=resp.json()['login'], github_hash=str(random.getrandbits(128)))
        db.session.add(user)
        db.session.commit()
        DiscordWebhook(url=discord_url, content=f"New user: {resp.json()['login']}. Check out profile at https://github.com/{resp.json()['login']}").execute()
    git_hash = user.github_hash
    return redirect(f"/docs?username={resp.json()['login']}&token={git_hash}")