1. Amanso

    Amanso Active Member

    Amanso
    MVP+
    Divest
    Guild Master
    Messages:
    178
    Hello everyone, I'm right now learning python and I'm trying to use the REST API to get player's solo skywars kills.

    I tried this but it doesn't seem to work:
    Code:
    import requests
    
    
    UUID = input('uuid?')
    
    endpoint = requests.get('https://api.hypixel.net/player?key=xxxx&uuid=' + UUID)
    
    print(endpoint.text['skywars_kills_solo'])
    Anyone knows how to do it?
     
    #1
  2. Amanso

    Amanso Active Member

    Amanso
    MVP+
    Divest
    Guild Master
    Messages:
    178
    (btw I replaced my API key with xxxx)
     
    #2
  3. Hey, the API returns result in json, so why don't you use json data for your endpoint?
    Also, when you request data through the API, you have a result with 'success':
    Code:
    {"success":true,"player":{...}}
    
    So for your code I suggest you to convert data to json ;)
    Code:
    import requests
    
    UUID = input('uuid?')
    KEY = 'YOUR_KEY'
    
    endpoint = requests.get('https://api.hypixel.net/player?key=' + KEY + '&uuid=' + UUID).json()
    
    print(endpoint['player']['achievements']['skywars_kills_solo'])
    
    PS: Be sure to check that the data you are searching exists :)
     
    #3
    • Useful Useful x 1
  4. Amanso

    Amanso Active Member

    Amanso
    MVP+
    Divest
    Guild Master
    Messages:
    178
    Thanks!

    Do you know how to get other games stats? (Murder Mystery, Turbo Kart Racers...etc.)
     
    #4
  5. It depends of the stats you want to know, some of them are in "Achievements" whereas some others are in "stats". For Survivor wins in Murder Mystery it is in achievements and named "murdermystery_wins_as_survivor" ;)
    However for TKR if you want to know the amount of gold trophies you have to search "gold_trophy" in ["stats"]["GingerBread"] (GingerBread is the named used for TKR).
    You can find the list of game type at github.com/HypixelDev/PublicAPI/blob/master/Documentation/misc/GameType.md or other documentation about the API on the GitHub: github.com/HypixelDev/PublicAPI :)
     
    #5
    • Like Like x 1
  6. Amanso

    Amanso Active Member

    Amanso
    MVP+
    Divest
    Guild Master
    Messages:
    178
    Thank you so much! <3
     
    #6

Share This Page