这是我得到的追溯:
Traceback (most recent call last): file "",line 70,in main response = service.scripts().run(body=request,scriptID=SCRIPT_ID).execute() file "/oauth2client/util.py",line 137,in positional_wrapper return wrapped(*args,**kwargs) file "apiclient/http.py",line 723,in execute raise httpError(resp,content,uri=self.uri)apiclient.errors.httpError: <httpError 404 when requesting https://script.GoogleAPIs.com/v1/scripts/ASFDQETWRQWEFAS12341234:run?alt=Json returned "Requested entity was not found.">
这是我正在使用的代码:
ScopES = ['https://mail.Google.com/','https://www.GoogleAPIs.com/auth/drive','https://www.GoogleAPIs.com/auth/spreadsheets']SCRIPT_ID = 'ASFDQETWRQWEFAS12341234'CLIENT_SECRET = '/file/path'def get_credentials(): with open(CLIENT_SECRET,'r') as f: content = Json.load(f) credentials = clIEnt.SignedJwtAssertionCredentials( content['clIEnt_email'],content['private_key'].encode(),ScopES) if hasattr(credentials,'access_token'): if (hasattr(credentials,'access_token_expired') and credentials.access_token_expired): http = httplib2.http() credentials.refresh(http) return credentialsdef main(unused_argv): credentials = get_credentials() http = credentials.authorize(httplib2.http()) service = build('script','v1',http=http) request = { 'function': 'test','devMode': True } response = service.scripts().run(body=request,scriptID=SCRIPT_ID).execute() if 'error' in response: raise AppsScriptError(response['error']) try: assert str(response['response']['result']) == 'Success!' except: raise AppsScriptError('Apps Script dIDn\'t complete successfully.')解决方法 看起来你必须去脚本项目,Publish>部署为API可执行文件并选择谁有权访问该脚本 – 任何人. 总结
以上是内存溢出为你收集整理的在Python中使用Apps Script Execution API时出现404错误全部内容,希望文章能够帮你解决在Python中使用Apps Script Execution API时出现404错误所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)