-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclock.py
More file actions
42 lines (33 loc) · 848 Bytes
/
Copy pathclock.py
File metadata and controls
42 lines (33 loc) · 848 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
31
32
33
34
35
36
37
38
39
40
41
42
from apscheduler.schedulers.blocking import BlockingScheduler
from InstagramBot import InstagramBot
import main
import os
sched = BlockingScheduler()
bot = None
isLoggedIn = False
def setup():
ig_username = os.environ.get("IG_USERNAME")
ig_password = os.environ.get("IG_PASSWORD")
global bot, isLoggedIn
bot = InstagramBot(ig_username, ig_password)
bot.signIn()
bot.gotoAccountEditPage()
isLoggedIn = True
def update():
global bot, isLoggedIn
try:
bot.editBio(main.getBioData())
print("update success")
except:
print("update failed")
bot.closeBrowser()
isLoggedIn = False
@sched.scheduled_job('interval', minutes=10)
def timed_job():
print("running clock")
if(not isLoggedIn):
setup()
update()
else:
update()
sched.start()