我正在使用mailjet Python API,我有点困惑。
https://www.mailjet.com/docs/api/lists/contacts
使用这个 API 类来调用 mailjets 的 GET 方法似乎是不可能的。任何人都可以确认是这种情况吗?
api.lists.Contacts(id='foo') # causes POST, thus 405
这是他们的 API 类。我什至没有看到ApiMethodFunction
将选项传递给connection
班级。
class ApiMethod(object):
def __init__(self, api, method):
self.api = api
self.method = method
def __getattr__(self, function):
return ApiMethodFunction(self, function)
def __unicode__(self):
return self.method
class ApiMethodFunction(object):
def __init__(self, method, function):
self.method = method
self.function = function
def __call__(self, **kwargs):
response = self.method.api.connection.open(
self.method,
self.function,
postdata=kwargs,
)
return json.load(response)
def __unicode__(self):
return self.function
这似乎是一个关键功能,所以我倾向于认为我只是在错误地使用它,但可能吗?
id
如果在 GET 参数中需要,您应该如何列出联系人?