我有一个小型Python应用程序,它提供了一个GUI,可以使用PysimpleGUI更新Google工作表.
这个过程运行得很好,但我需要将JSON密钥文件"放在"EXE文件的旁边,以便它运行(JSON为访问Google工作表提供身份验证密钥).
如果没有,是否有其他方法可以让最终用户尽可能地简单明了?
这是代码的当前相关部分:
import gspread
import pandas as pd
from oauth2client.service_account import ServiceAccountCredentials
import PySimpleGUI as sg
# define the scope
scope = ['https://spreadsheets.google.com/feeds','https://www.googleapis.com/auth/drive']
# add credentials to the account
creds = ServiceAccountCredentials.from_json_keyfile_name('ABCDEFG.json', scope)
# authorize the clientsheet
client = gspread.authorize(creds)