GCE Python API:oauth2client.util:execute()最多接受1个位置参数(给定2个) [英] GCE Python API: oauth2client.util:execute() takes at most 1 positional argument (2 given)

查看:83
本文介绍了GCE Python API:oauth2client.util:execute()最多接受1个位置参数(给定2个)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试通过尽管每次拨打电话response = request.execute(auth_http),我都会收到以下无法验证的错误信号:

Whenever making the call response = request.execute(auth_http) though, I get the following error signaling that I can't authenticate:

WARNING:oauth2client.util:execute() takes at most 1 positional argument (2 given)

我显然只传递了一个位置参数(auth_http),并且我已经研究了oauth2client/util.py,apiclient/http.py和oauth2client/client.py的答案,但是似乎没有什么错.我发现另一个堆栈溢出帖子,遇到了相同的问题,但是似乎在oauth2client/client.py的OAuth2WebServerFlow类的构造函数中,"access_type"已设置为"offline"(虽然说实话,我不完全了解设置oauth2.0流的过程) ).

I'm clearly only passing one positional argument (auth_http), and I've looked into oauth2client/util.py, apiclient/http.py, and oauth2client/client.py for answers, but nothing seems amiss. I found another stack overflow post that encountered the same issue, but it seems that in the constructor of the OAuth2WebServerFlow class in oauth2client/client.py, 'access_type' is set to 'offline' already (though to be honest I don't completely understand what's going on here in terms of setting up oauth2.0 flows).

任何建议将不胜感激,并在此先感谢!

Any suggestions would be much appreciated, and thanks in advance!

推荐答案

看代码,@ util.positional(1)注释引发警告.避免使用命名参数.

Looking at the code, the @util.positional(1) annotation is throwing the warning. Avoid it using named parameters.

代替:

response = request.execute(auth_http)

做:

response = request.execute(http=auth_http)

https://code.google.com /p/google-api-python-client/source/browse/apiclient/http.py#637

这篇关于GCE Python API:oauth2client.util:execute()最多接受1个位置参数(给定2个)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆