1

我正在使用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 参数中需要,您应该如何列出联系人?

4

1 回答 1

1

python 库现已修复。根据作者的说法,您现在可以传递一个参数来指定请求是 POST 还是 GET

https://github.com/WoLpH/mailjet

于 2012-09-08T07:50:23.650 回答