-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
GTStatus.py
23 lines (22 loc) · 968 Bytes
/
GTStatus.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import requests
from datetime import datetime
from pytz import timezone
def GameData():
Result = {
"Online_User": "",
"WOTDLink" : "",
"WOTDName" : "",
"GTTime" : "",
"GTDate" : ""
}
try:
Website = requests.get(f"https://www.growtopiagame.com/detail").json()
Result["Online_User"] = Website["online_user"]
Result["WOTDLink"] = Website["world_day_images"]["full_size"]
Result["WOTDName"] = ((Result["WOTDLink"].replace('https://www.growtopiagame.com/worlds/','')).replace('.png','')).upper()
Result["GTTime"] = datetime.now(timezone('UTC')).astimezone(timezone('America/New_York')).strftime("%X")
Result["GTDate"] = datetime.now(timezone('UTC')).astimezone(timezone('America/New_York')).strftime("%x")
return Result
except:
return({"Error":"It looks like we can't reach growtopiagame.com! Error code 2"})
print(GameData())