Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import pygsheets
- import pandas as pd
- import gspread
- from oauth2client.service_account import ServiceAccountCredentials
- import time
- scope = ['https://spreadsheets.google.com/feeds', 'https://www.googleapis.com/auth/drive']
- credentials = ServiceAccountCredentials.from_json_keyfile_name('here goes the path to the json', scope)
- inputfile = open("here goes the path to the log")
- lines = []
- gc = gspread.authorize(credentials)
- wks = gc.open("Lies").sheet1
- i = 0
- def parseline(line):
- time.sleep(1)
- lines.append(line)
- line = line.split(" ")
- if(line[3] == 'lies_bot'):
- command = lines[len(lines)-2]
- command = command.split(" ")
- try:
- if(command[3] == '!input'):
- global i
- i+=1
- wks.update_cell(sys.argv[1],1,command[4])
- except Exception as e:
- print(i)
- if(len(lines)>1000):
- reset_lines()
- def reset_lines():
- temp1 = lines[len(lines)-1]
- temp2 = lines[len(lines)-2]
- lines.clear()
- lines.append(temp2)
- lines.append(temp1)
- while 1:
- l = ''
- while (l == ''):
- time.sleep(.5)
- l = inputfile.readline()
- try:
- parseline(l)
- except Exception as e:
- l = l.split(" ")
- print(l)
- print(e)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement