mirror of
https://github.com/anatolykopyl/dochunt.git
synced 2026-03-26 12:54:41 +00:00
🚀 Somewhat working version
This commit is contained in:
19
utils/authenticate.py
Normal file
19
utils/authenticate.py
Normal file
@@ -0,0 +1,19 @@
|
||||
import vk_api
|
||||
import configparser
|
||||
from rich.console import Console
|
||||
c = Console()
|
||||
|
||||
config = configparser.ConfigParser()
|
||||
config.read('config.ini')
|
||||
login = config['CREDENTIALS']['login']
|
||||
password = config['CREDENTIALS']['password']
|
||||
|
||||
def _2fa_handler():
|
||||
code = c.input("Enter 2FA code: ", style="italic cyan")
|
||||
return code, True
|
||||
|
||||
def authenticate():
|
||||
vk_session = vk_api.VkApi(login=login, password=password, auth_handler=_2fa_handler)
|
||||
vk_session.auth()
|
||||
|
||||
return vk_session.get_api()
|
||||
Reference in New Issue
Block a user