How to use the aiogoogle.Aiogoogle function in aiogoogle

To help you get started, we’ve selected a few aiogoogle examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github omarryhan / aiogoogle / tests / test_integration / test_discovery_doc_io.py View on Github external
async def test_download_aiogoogle_without_version(name, version):
    aiogoogle = Aiogoogle()
    google_api = await aiogoogle.discover(name)
    assert google_api.discovery_document['name'] == name
    #assert google_api.discovery_document['version'] == version
github omarryhan / aiogoogle / examples / auth(production_unsafe) / openid_connect_cli.py View on Github external
async def main():
    nonce = create_secret()
    aiogoogle = Aiogoogle(client_creds=CLIENT_CREDS)
    uri = aiogoogle.openid_connect.authorization_url(
        client_creds=CLIENT_CREDS,
        nonce=nonce,
        access_type="offline",
        include_granted_scopes=True,
        prompt="select_account",
    )
    webbrowser.open_new_tab(uri)
    grant = input("Paste the code you received here, then press Enter")
    full_user_creds = await aiogoogle.openid_connect.build_user_creds(
        grant=grant, client_creds=CLIENT_CREDS, nonce=nonce, verify=False
    )
    full_user_info = await aiogoogle.openid_connect.get_user_info(full_user_creds)
    print(
        f"full_user_creds: {pprint.pformat(full_user_creds)}\n\nfull_user_info: {pprint.pformat(full_user_info)}"
    )
github omarryhan / aiogoogle / examples / auth(production_unsafe) / oauth2.py View on Github external
EMAIL = config["user_creds"]["email"]
CLIENT_CREDS = {
    "client_id": config["client_creds"]["client_id"],
    "client_secret": config["client_creds"]["client_secret"],
    "scopes": config["client_creds"]["scopes"],
    "redirect_uri": "http://localhost:5000/callback/aiogoogle",
}
state = create_secret()  # Shouldn't be a global hardcoded variable.


LOCAL_ADDRESS = "localhost"
LOCAL_PORT = "5000"

app = Sanic(__name__)
aiogoogle = Aiogoogle(client_creds=CLIENT_CREDS)

# ----------------------------------------#
#                                        #
# **Step A (Check OAuth2 figure above)** #
#                                        #
# ----------------------------------------#


@app.route("/authorize")
def authorize(request):
    if aiogoogle.oauth2.is_ready(CLIENT_CREDS):
        uri = aiogoogle.oauth2.authorization_url(
            client_creds=CLIENT_CREDS,
            state=state,
            access_type="offline",
            include_granted_scopes=True,
github omarryhan / aiogoogle / examples / auth(production_unsafe) / openid_connect.py View on Github external
"scopes": config["client_creds"]["scopes"],
    "redirect_uri": "http://localhost:5000/callback/aiogoogle",
}
state = (
    create_secret()
)  # Shouldn't be a global or a hardcoded variable. should be tied to a session or a user and shouldn't be used more than once
nonce = (
    create_secret()
)  # Shouldn't be a global or a hardcoded variable. should be tied to a session or a user and shouldn't be used more than once


LOCAL_ADDRESS = "localhost"
LOCAL_PORT = "5000"

app = Sanic(__name__)
aiogoogle = Aiogoogle(client_creds=CLIENT_CREDS)

# ----------------------------------------#
#                                        #
# **Step A (Check OAuth2 figure above)** #
#                                        #
# ----------------------------------------#


@app.route("/authorize")
def authorize(request):
    if aiogoogle.openid_connect.is_ready(CLIENT_CREDS):
        uri = aiogoogle.openid_connect.authorization_url(
            client_creds=CLIENT_CREDS,
            state=state,
            nonce=nonce,
            access_type="offline",