aiograpi

🔥 Asynchronous Python library for Instagram Private API 2024

View on GitHub

TOTP

TOTP setup and code generation

Method Return Description
totp_generate_seed() str Generate 2FA TOTP seed
totp_enable(verification_code: str) List[str] Enable TOTP 2FA (return backup keys, save it)
totp_disable() bool Disable TOTP 2FA
totp_generate_code(seed: str) str Generate 2FA TOTP code (you can use it instead of Google Authenticator)

Example:

>>> from aiograpi import Client
>>> cl = Client()
>>> await cl.login(USERNAME, PASSWORD)

>>> seed = await cl.totp_generate_seed()
"67EIYPWCIJDTTVX632NEODKEU2PY5BIW"

>>> code = await cl.totp_generate_code(seed)
"123456"

>>> await cl.totp_enable(code)
["1234 5678", "1234 5678", "1234 5678", "1234 5678", "1234 5678"]

>>> await cl.totp_disable()
True