D
D
dmtb0y2020-09-10 16:12:34
Python
dmtb0y, 2020-09-10 16:12:34

How to make 2 loops in while?

Hello, how can I make the cycle with "setOnline" work first, then "SetOffline" and so on in turn until the script is stopped.
Thanks in advance.

import vk_api
import time
 
auth = input("Укажите токен: ")
connect = auth
timer1 = input("Количество минут в онлайне:")
timer2 = input("Количество минут в оффлайне:")
tm1 = timer1
tm2 = timer2
print("AutoOnline by Djozef")	
while True:
  try:
    vk = vk_api.VkApi(token= connect)
    vk.method("account.setOnline")
    time.sleep(tm1)
    print("Статус онлайна: Offline")
    vk.method("account.setOffline")
    time.sleep(tm2)		
    print("Статус онлайна: Online")
  except Exception as e:
    time.sleep(30)

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question