-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclient.py
More file actions
30 lines (22 loc) · 736 Bytes
/
client.py
File metadata and controls
30 lines (22 loc) · 736 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import sys
from instagrapi import Client
from helpers.configutils import read_config
from helpers.instautils import login
from helpers.logutils import clientlogger as logger
from helpers.logutils import consolelog
cl = Client()
cl = login(cl)
if cl is not None:
cl.delay_range = [
int(read_config("ratelimit", "min_delay", 2)), # type: ignore
int(read_config("ratelimit", "max_delay", 5)), # type: ignore
]
consolelog(
f"Logged in to Instagram as: {(cl.account_info().dict()).get('username')}"
)
logger.info("Logged in to Instagram")
logger.debug(cl.account_info())
else:
consolelog("Failed to log in. Check client.log")
logger.error("Failed to log in")
sys.exit(0)