Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import gspread
- from pfaw import Fortnite, Platform
- from oauth2client.service_account import ServiceAccountCredentials
- fortnite = Fortnite(fortnite_token='ZWM2ODRiOGM2ODdmNDc5ZmFkZWEzY2IyYWQ4M2Y1YzY6ZTFmMzFjMjExZjI4NDEzMTg2MjYyZDM3YTEzZmM4NGQ=',
- launcher_token='MzRhMDJjZjhmNDQxNGUyOWIxNTkyMTg3NmRhMzZmOWE6ZGFhZmJjY2M3Mzc3NDUwMzlkZmZlNTNkOTRmYzc2Y2Y',
- password='penis', email='nicholasblaskey@gmail.com')
- class pStats():
- def __init__(self, username):
- self.stats = fortnite.battle_royale_stats(username=username, platform=Platform.pc)
- self.soloStats = [self.stats.solo.matches, self.stats.solo.kills, round(self.stats.solo.kills / self.stats.solo.matches, 2),
- self.stats.solo.wins, str(round(self.stats.solo.wins / self.stats.solo.matches, 2)) + "%"]
- self.duoStats = [self.stats.duo.matches, self.stats.duo.kills, round(self.stats.duo.kills / self.stats.duo.matches, 2),
- self.stats.duo.wins, str(round(100 * self.stats.duo.wins / self.stats.duo.matches, 2)) + "%"]
- self.squadStats = [self.stats.squad.matches, self.stats.squad.kills, round(self.stats.squad.kills / self.stats.squad.matches, 2),
- self.stats.squad.wins, str(round(100 * self.stats.squad.wins / self.stats.squad.matches, 2)) + "%"]
- self.allStats = self.soloStats + self.duoStats + self.squadStats
- self.index = ["Username: ", "Games Played: ", "Kills: ", "KD: ", "Wins: ", "Win Ratio: "]
- def getStats(self):
- return self.allStats
- def main():
- scope = ['https://spreadsheets.google.com/feeds',
- 'https://www.googleapis.com/auth/drive']
- credentials = ServiceAccountCredentials.from_json_keyfile_name('creds.json', scope)
- gc = gspread.authorize(credentials)
- wks = gc.open("fratnite").sheet1
- #list of indexs
- 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"]
- #get list of names
- names = wks.row_values(1)[1:]
- index = 0
- for i in names:
- allStats = pStats(i).getStats()
- for j in range(14):
- wks.update_acell(indexs[index]+str(j + 2), allStats[j])
- index += 1
- if __name__ == '__main__':
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement