Update to 0.16.0

This commit is contained in:
Brieuc Dubois 2023-05-29 16:58:15 +02:00
parent 0b746c4046
commit fcc4e715ee
2 changed files with 6 additions and 3 deletions

View File

@ -20,12 +20,15 @@ def load_creds():
if not os.path.exists('/data/token'): if not os.path.exists('/data/token'):
client = TgtgClient(email=os.environ.get('TGTG_EMAIL')) client = TgtgClient(email=os.environ.get('TGTG_EMAIL'))
print('Waiting for credentials ...')
credentials = client.get_credentials() credentials = client.get_credentials()
with open('/data/token', 'w') as file: with open('/data/token', 'w') as file:
file.write(str(credentials)) file.write(str(credentials))
print('Credentials stored in file')
else: else:
with open('/data/token', 'r') as file: with open('/data/token', 'r') as file:
credentials = json.loads(file.read().replace('\'', '"')) credentials = json.loads(file.read().replace('\'', '"'))
print('Credentials loaded from file')
client = TgtgClient(**credentials) client = TgtgClient(**credentials)
bot = telegram.Bot(os.environ['TELEGRAM_TOKEN']) bot = telegram.Bot(os.environ['TELEGRAM_TOKEN'])
@ -85,6 +88,6 @@ async def main():
time.sleep(60) time.sleep(60)
if __name__ == '__main__': if __name__ == '__main__':
check_env() print('Check environ:', check_env())
load_creds() load_creds()
asyncio.run(main()) asyncio.run(main())

View File

@ -1,3 +1,3 @@
# Tested versions. Upgrade at your own risks # Tested versions. Upgrade at your own risks
tgtg==0.15.0 tgtg==0.16.0
python-telegram-bot==20.2 python-telegram-bot==20.2