Quellcode durchsuchen

Remove outdated oauth

bryan vor 4 Tagen
Ursprung
Commit
f095938c9f
1 geänderte Dateien mit 2 neuen und 9 gelöschten Zeilen
  1. 2 9
      nba-playoffs-game-updater.py

+ 2 - 9
nba-playoffs-game-updater.py

@@ -2,7 +2,6 @@
 
 import gspread
 import random
-from oauth2client.service_account import ServiceAccountCredentials
 import datetime
 import time
 from nba_api.stats.static import players
@@ -60,14 +59,8 @@ Returns a worksheet instance
 """
 def getWorksheet(spreadsheet_key, json_keyfile):
     try:
-        scope = ['https://spreadsheets.google.com/feeds', 'https://www.googleapis.com/auth/drive']
-        credentials = ServiceAccountCredentials.from_json_keyfile_name(json_keyfile, scope)
         gc = gspread.service_account(filename=json_keyfile)
         return gc.open_by_key(spreadsheet_key).worksheet("Picks")
-        # gc = gspread.authorize(credentials)
-        # spreadsheet = gc.open_by_key(spreadsheet_key)
-        # worksheet = spreadsheet.worksheet("Picks")
-        # return worksheet
     except Exception as e:
         print(f"Exception: {str(e)}")
         print("Could not retrieve worksheet!")
@@ -305,9 +298,9 @@ if __name__ == "__main__":
             players_unique, batch_update_list, all_values = cleanPlayers(all_values, first_row, last_row, batch_update_list)
             stats_dict, good_proxy_list = getStats(players_unique, url_date, season, proxy_list=proxy_list, good_proxy_list=good_proxy_list)
             batch_update_list = cellsToUpdate(all_values, first_row, last_row, stats_dict, stats, batch_update_list)
-            if len(batch_update_list) > 1:
+            if len(batch_update_list) > 0:
                 print(batch_update_list)
-            batchUpdate(batch_update_list)
+                batchUpdate(batch_update_list)
         except Exception as e:
             print(e)
             print('Sleeping for 10 seconds')