【发布时间】:2016-06-08 18:02:48
【问题描述】:
我正在编写一个简单的 Google 脚本来更新电子表格(来自 Google tutorial)。我将此脚本部署为 API 可执行文件,可以通过 python 代码从我的计算机调用,我将其要点包括在下面。
api_id = 'xxxxxxxxxxxxxxxxxxxxxxxxx' # where do I specify the api version?
credentials = get_credentials()
http = credentials.authorize(httplib2.Http())
script_service = discovery.build('script', 'v1', http=http)
request = {"function": "updateListenerStatus", # function name to call inside the Google script
"parameters": [data], # JSON argument passed to the function
"devMode": True} # run the most recently saved instead of published version
response = script_service.scripts().run(body=request, scriptId=api_id).execute()
一切都很好,除了我想利用版本功能。通过阅读文档,我发现通过将“devMode”更改为 False,我可以运行最近发布的脚本版本,而不是最近保存的版本。但是,如果我想运行较旧的已发布版本怎么办?当我将一个 Google 脚本导入另一个 Google 脚本时,我熟悉指定库版本,但是有什么方法可以让我从我的 python 代码中指定版本号?
【问题讨论】:
标签: google-apps-script google-api-python-client