Google API SignedJwtAssertionCredentials更改子帐户

时间:2014-06-12 18:43:08

标签: python google-api google-api-client google-api-python-client

我目前正在制作一些连接到我们的Google应用领域的代​​码,进行一些管理更改,然后冒充我们域中的不同用户,并将数据上传到他们的驱动器,电子邮件和日历。我想要做的是弄清楚使用SignedJwtAssertionCredentials并更改" sub"的正确方法。 kwarg。我是否需要为每个我想要模仿的用户重做整个oauth过程,即......

http = httplib2.Http()
credentials = SignedJwtAssertionCredentials(service_account, key, scope=api_scopes, sub=current_user)
http = credentials.authorize(http)
service = build(api_service, api_version, http=http)

或者有没有办法只更新/修改sub kwarg然后重新授权httplib2对象?

我尝试按照我描述的第一种方式进行操作,它似乎无法正常工作,大约在程序执行的一半时间,我开始得到奇怪的错误,

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

有没有人对我为什么会收到此错误有任何想法,或者我是否可以实施oauth流程以实现我需要的最佳方式?

谢谢!

0 个答案:

没有答案