init
This commit is contained in:
commit
6803e4cd3c
7
config.json
Normal file
7
config.json
Normal file
@ -0,0 +1,7 @@
|
||||
{
|
||||
"email": "email",
|
||||
"access_token": "",
|
||||
"refresh_token": "",
|
||||
"user_id": "",
|
||||
"cookie": ""
|
||||
}
|
22
main.py
Normal file
22
main.py
Normal file
@ -0,0 +1,22 @@
|
||||
from tgtg import TgtgClient
|
||||
import json
|
||||
|
||||
def main():
|
||||
file = open('config.json')
|
||||
config = json.load(file)
|
||||
|
||||
try:
|
||||
client = TgtgClient(access_token=config.get("access_token"), refresh_token=config.get("refresh_token"), user_id=config.get("user_id"), cookie=config.get("cookie"))
|
||||
client.get_credentials()
|
||||
except:
|
||||
client = TgtgClient(email=config.get("email"))
|
||||
credentials = client.get_credentials()
|
||||
config.update(credentials)
|
||||
with open("config.json", "w") as outfile:
|
||||
json.dump(config, outfile)
|
||||
favorites = client.get_favorites()
|
||||
for favorite in favorites:
|
||||
if (favorite.get("items_available") > 0):
|
||||
print(favorite.get("display_name"), favorite.get("items_available"), "\n")
|
||||
if (__name__ == "__main__"):
|
||||
main()
|
Loading…
Reference in New Issue
Block a user