간단한 Google 스크립트를 작성하여 스프레드 시트를 업데이트합니다 (Google tutorial부터). 나는이 스크립트를 Python 코드를 통해 내 컴퓨터에서 호출 할 수있는 API 실행 파일로 배포한다. 아래 요점은 그 중 요지이다.Google 스크립트 호출시 버전 번호 지정
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 스크립트로 가져올 때 라이브러리 버전을 지정하는 것에 익숙하지만 파이썬 코드에서 버전 번호를 지정할 수있는 방법이 있습니까?
필자는 원하는 스크립트를 직접 실행할 수는 있지만 필자는 동시에 여러 버전을 지원할 수 있기를 바랍니다. 이 도구는 많은 엔지니어들에 의해 사용 될 것이므로 스크립트 또는 클라이언트를 이전 버전과 호환되도록 변경하고 싶습니다. 어쩌면 Google 스크립트로이를 수행 할 방법이 없을 수도 있습니다. – david11