TypeError:\uyu init_uu()只接受1个参数(给定6个参数)

2024-06-12 21:44:42 发布

您现在位置:Python中文网/ 问答频道 /正文

致力于在本地构建googlecloudendpoints API,了解如何构造消息。此API将使管理SDK报表API a活动:列表方法可用,但受OU限制(对于使用G套件的用户)。在包含一组重复消息的消息上遇到构造错误:

ERROR    2019-04-01 12:01:58,861 service.py:191] Encountered unexpected error from ProtoRPC method implementation: TypeError (__init__() takes exactly 1 argument (6 given))
Traceback (most recent call last):
  File "/Users/me/google-cloud-sdk/platform/google_appengine/lib/protorpc-1.0/protorpc/wsgi/service.py", line 181, in protorpc_service_app
    response = method(instance, request)
  File "/Users/me/Documents/GitHub/activitylogs_api/lib/endpoints/api_config.py", line 1351, in invoke_remote
    return remote_method(service_instance, request)
  File "/Users/me/google-cloud-sdk/platform/google_appengine/lib/protorpc-1.0/protorpc/remote.py", line 414, in invoke_remote_method
    response = method(service_instance, request)
  File "/Users/me/Documents/GitHub/activitylogs_api/main.py", line 142, in list_activities
    events=[event1,event2]
TypeError: __init__() takes exactly 1 argument (6 given)
INFO     2019-04-01 12:01:58,873 module.py:861] default: "GET /_ah/api/activitylogs/v1/list HTTP/1.1" 503 196

代码如下:

^{pr2}$

Tags: inpyapi消息remotelibservicegoogle
1条回答
网友
1楼 · 发布于 2024-06-12 21:44:42

所有字段都需要作为关键字参数传入,包括idactor

activity1 = Activity(
    id=id,
    actor=actor,
    ownerDomain="me.com",
    ipAddress="127.0.0.1",
    events=[event1,event2]
)
activity2 = Activity(
    id=id,
    actor=actor,
    ownerDomain="me.com",
    ipAddress="127.0.0.1",
    events=[event1,event2]
)

相关问题 更多 >