-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmain.py
32 lines (26 loc) · 905 Bytes
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# Files
from __future__ import division
import secrets
from sheets import update_sheet
from library import get_player_rows, get_reports
# Libraries
import requests
import datetime as dt
import gspread
import time
# Google Sheets
from oauth2client.service_account import ServiceAccountCredentials
from apiclient.discovery import build
from httplib2 import Http
scope = ['https://spreadsheets.google.com/feeds', 'https://www.googleapis.com/auth/drive']
credentials = ServiceAccountCredentials.from_json_keyfile_name(secrets.google_json_file, scope)
gc = gspread.authorize(credentials)
service = build('sheets', 'v4', http=credentials.authorize(Http()))
wb = gc.open_by_key(secrets.google_sheet_id)
def main():
wks = wb.worksheet('players')
reports = get_reports(secrets.raid_id, secrets.c_date)
players = get_player_rows(reports)
update_sheet(wks, players)
if __name__ == '__main__':
main()