Hey Guys so im stuck here for like an hour ill poste the code;
import requests
import time
base_url = "https://minecraftonline.com/cgi-bin/"
def get_user_info(user):
firstseen = f"{base_url}/getfirstseen?{user}"
lastseen = f"{base_url}/getlastseen?{user}"
timeonline = f"{base_url}/gettimeonline?{user}"
response = requests.get(firstseen)
if response.status_code == 200:
print(f"First Seen;\n{response.text}")
else:
print(f"Failed To Retrieve Data {response.status_code}")
response = requests.get(lastseen)
if response.status_code == 200:
print(f"Last Seen;\n{response.text}")
else:
print(f"Failed To Retrieve Data {response.status_code}")
response = requests.get(timeonline)
seconds = response.text
clean_seconds = seconds.strip()
convert = time.strftime("%H:%M:%S", time.gmtime(clean_seconds))
if response.status_code == 200:
print(f"Time Played;\n{convert}")
else:
print(f"Failed To Retrieve Data {response.status_code}")
user_name = "Egitto"
user_info = get_user_info(user_name)
Im trying to get the seconds (The seconds are formatted as "2718289\n" thats why i do clean_seconds) from an API, and i would need to transform it into a readable time