0

I am trying to create a function that loops through the players and gets a player's stats. However, I am never receiving the stats back. Here is the code:

queue = []
player_list = {}

def update_stats():
    os.system("cls")
    for player in queue:
        url = f'https://api.mojang.com/users/profiles/minecraft/{player}'
        response = requests.get(url)
        uuid = response.json()['id']
        requestlink = str(f"https://api.hypixel.net/player?key={api_key}&uuid=" + uuid)
        
        hydata = requests.get(requestlink).json()

        level = int(hydata['achievements']['bedwars_level'])

        player_list[player] = [str(level)]
    print(player_list)
  • What is `queue` once the function is called? Have you used a debugger to step through your code at all? – B Remmelzwaal Mar 02 '23 at 22:21
  • 1
    I suggest you post a [mre]. – khelwood Mar 02 '23 at 22:22
  • It contains the list of players that the program will get the stats about. – Riyan Nayak Mar 02 '23 at 22:22
  • Yes, I had debugged it. And the source of the problem seems to be from the uuid – Riyan Nayak Mar 02 '23 at 22:29
  • "_the source of the problem seems to be from uuid_", can you be a bit more specific? As we have absoluteley no data, and can't execute ourselves this function because no example data for queue and player_list, currently you only can see some pointers, some debug results. – Pac0 Mar 03 '23 at 07:03

0 Answers0