Advertisement
Guest User

Untitled

a guest
Apr 17th, 2018
4,185
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.33 KB | None | 0 0
  1. import gspread
  2. from pfaw import Fortnite, Platform
  3. from oauth2client.service_account import ServiceAccountCredentials
  4. fortnite = Fortnite(fortnite_token='ZWM2ODRiOGM2ODdmNDc5ZmFkZWEzY2IyYWQ4M2Y1YzY6ZTFmMzFjMjExZjI4NDEzMTg2MjYyZDM3YTEzZmM4NGQ=',
  5. launcher_token='MzRhMDJjZjhmNDQxNGUyOWIxNTkyMTg3NmRhMzZmOWE6ZGFhZmJjY2M3Mzc3NDUwMzlkZmZlNTNkOTRmYzc2Y2Y',
  6. password='penis', email='nicholasblaskey@gmail.com')
  7.  
  8.  
  9.  
  10. class pStats():
  11. def __init__(self, username):
  12. self.stats = fortnite.battle_royale_stats(username=username, platform=Platform.pc)
  13.  
  14. self.soloStats = [self.stats.solo.matches, self.stats.solo.kills, round(self.stats.solo.kills / self.stats.solo.matches, 2),
  15. self.stats.solo.wins, str(round(self.stats.solo.wins / self.stats.solo.matches, 2)) + "%"]
  16.  
  17. self.duoStats = [self.stats.duo.matches, self.stats.duo.kills, round(self.stats.duo.kills / self.stats.duo.matches, 2),
  18. self.stats.duo.wins, str(round(100 * self.stats.duo.wins / self.stats.duo.matches, 2)) + "%"]
  19.  
  20. self.squadStats = [self.stats.squad.matches, self.stats.squad.kills, round(self.stats.squad.kills / self.stats.squad.matches, 2),
  21. self.stats.squad.wins, str(round(100 * self.stats.squad.wins / self.stats.squad.matches, 2)) + "%"]
  22.  
  23. self.allStats = self.soloStats + self.duoStats + self.squadStats
  24. self.index = ["Username: ", "Games Played: ", "Kills: ", "KD: ", "Wins: ", "Win Ratio: "]
  25.  
  26. def getStats(self):
  27. return self.allStats
  28.  
  29. def main():
  30.  
  31. scope = ['https://spreadsheets.google.com/feeds',
  32. 'https://www.googleapis.com/auth/drive']
  33.  
  34. credentials = ServiceAccountCredentials.from_json_keyfile_name('creds.json', scope)
  35.  
  36. gc = gspread.authorize(credentials)
  37.  
  38. wks = gc.open("fratnite").sheet1
  39.  
  40. #list of indexs
  41. indexs = ["B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"]
  42.  
  43. #get list of names
  44. names = wks.row_values(1)[1:]
  45.  
  46. index = 0
  47. for i in names:
  48. allStats = pStats(i).getStats()
  49. for j in range(14):
  50. wks.update_acell(indexs[index]+str(j + 2), allStats[j])
  51. index += 1
  52.  
  53. if __name__ == '__main__':
  54. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement