Advertisement
dumle29

Untitled

Aug 26th, 2017
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.95 KB | None | 0 0
  1. from time import sleep
  2. from pypubg import core
  3.  
  4. API = core.PUBGAPI("YOUR KEY HERE") # Get a key here: https://pubgtracker.com/site-api
  5.  
  6. #players = ["Duckle29", "Duckle29"]
  7.  
  8. result_list = []
  9.  
  10. for player in players:
  11.     result_list.append(API.player(player))
  12.     if 'error' in result_list[-1]:
  13.         print("Error retrieving stats for player {}: {}".format(player, result_list[-1]['message']))
  14.         del result_list[-1]
  15.  
  16.     sleep(1)
  17.  
  18. season = None
  19. #season = 'All'
  20.  
  21. for RESULT in result_list:
  22.  
  23.     if season is None:
  24.         season = RESULT['defaultSeason']
  25.  
  26.     max_rating = 0.0
  27.  
  28.     for stat in RESULT['Stats']:
  29.         if stat['Season'] == season or season == 'All':
  30.             for datas in stat['Stats']:
  31.                 if datas['label'] == 'Rating':
  32.                     if float(datas['value']) > max_rating:
  33.                         max_rating = float(datas['value'])
  34.  
  35.     print(" {} : {}".format(RESULT['PlayerName'], max_rating))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement