def dorolls(t=''):
    a = API()
    a.setDevice('ios')
    a.reroll()
    a.update_rating()
    b = API()
    b.setDevice('ios')
    b.setOpenId(a.open_id)
    b.setToken(a.token)
    b.login_and_collect()
    b.addAccountToDb()
from main import API
import time

while (1):
    try:
        a = API()
        a.reroll()
    except:
        time.sleep(5)
        pass