no-name-user-name / pyTelegramWalletApi

Telegram Wallet Api / Send and recieve tokens / Trade on P2P market
https://t.me/wallet
60 stars 5 forks source link

headless=True #19

Closed kxvvv closed 3 weeks ago

kxvvv commented 1 month ago

stopped working with argument headless=True, can't find the token

no-name-user-name commented 1 month ago

try parse token to file in loop with try/except like this

import time

from wallet import Client

def update_token():
    while True:
        try:
            client = Client(profile='main', headless=True)

            try:
                auth_token = client.get_token()
                print(auth_token)
                with open('token.txt', 'w') as f:
                    f.write(auth_token)
            except Exception as e:
                raise Exception(f"[!] Error get_token: {e}")
            finally:
                client.stop()

            time.sleep(60*5)
        except Exception as e:
            print(f"[!] Error update_token: {e}")
            time.sleep(15)

if __name__ == '__main__':
    update_token()