我正试图为python-2.7中的reseller api
创建一个包含oauth 2.0
的service
。Oauth 2.0工作正常,因为我已经验证了我可以获得access token
。我收到此错误消息,因为我找不到经销商服务的正确文档。尽管阅读了apiclient.discovery.build
中的代码,但有人能帮我确定问题吗(问题在本消息的最后部分)。
错误如下:
Traceback (most recent call last):
File "C:Program Files (x86)Googlegoogle_appenginelibwebapp2-2.5.2webapp2.py", line 1535, in __call__
rv = self.handle_exception(request, response, e)
File "C:Program Files (x86)Googlegoogle_appenginelibwebapp2-2.5.2webapp2.py", line 1529, in __call__
rv = self.router.dispatch(request, response)
File "C:Program Files (x86)Googlegoogle_appenginelibwebapp2-2.5.2webapp2.py", line 1278, in default_dispatcher
return route.handler_adapter(request, response)
File "C:Program Files (x86)Googlegoogle_appenginelibwebapp2-2.5.2webapp2.py", line 1102, in __call__
return handler.dispatch()
File "C:Program Files (x86)Googlegoogle_appenginelibwebapp2-2.5.2webapp2.py", line 572, in dispatch
return self.handle_exception(e, self.app.debug)
File "C:Program Files (x86)Googlegoogle_appenginelibwebapp2-2.5.2webapp2.py", line 570, in dispatch
return method(*args, **kwargs)
File "C:xampphtdocsreseller-asteriainteractiveoauth2clientappengine.py", line 777, in setup_oauth
resp = method(request_handler, *args, **kwargs)
File "C:xampphtdocsreseller-asteriainteractivemain.py", line 74, in post
customer_document = customers.insert().execute(decorator.http())
File "C:xampphtdocsreseller-asteriainteractiveapiclientdiscovery.py", line 583, in method
raise TypeError('Missing required parameter "%s"' % name)
TypeError: Missing required parameter "body"
这是我的代码:
class CustomerCreateHandler(BaseHandler):
@decorator.oauth_aware
def post(self):
admin_user = users.is_current_user_admin()
user = users.get_current_user()
if user:
if decorator.has_credentials():
customers = reseller_service.customers()
customer_document = customers.insert().execute(decorator.http())
self.redirect('/customer/create/')
应该如何构建经销商服务?我应该把"body"参数放在哪里?
太棒了!
我终于在Google API客户端库中找到了这一点:https://developers.google.com/resources/api-libraries/documentation/reseller/v1sandbox/python/latest/reseller_v1sandbox.customers.html