Browse files

added support for `method` parameter to switch between GET and POST

  • Loading branch information...
1 parent 641a8dd commit 01f0709fc2e1f80e65e0eb6fcea819eb361943d8 @WoLpH committed Sep 8, 2012
Showing with 12 additions and 2 deletions.
  1. +1 −0 README.rst
  2. +9 −1 mailjet/api.py
  3. +1 −0 setup.cfg
  4. +1 −1 setup.py
View
1 README.rst
@@ -50,6 +50,7 @@ To put data:
>>> print api.user.addcontact(
contact='user@domain.com',
id=list_['list_id'],
+ method='POST',
)
View
10 mailjet/api.py
@@ -28,10 +28,18 @@ def __init__(self, method, function):
self.function = function
def __call__(self, **kwargs):
+ if kwargs.pop('method', 'GET') == 'POST':
+ postdata = kwargs
+ options = None
+ else:
+ options = kwargs
+ postdata = None
+
response = self.method.api.connection.open(
self.method,
self.function,
- postdata=kwargs,
+ options=options,
+ postdata=postdata,
)
return json.load(response)
View
1 setup.cfg
@@ -10,3 +10,4 @@ all_files = 1
[upload_sphinx]
upload-dir = docs/_build/html
+
View
2 setup.py
@@ -8,7 +8,7 @@
setup(
name = 'mailjet',
- version = '1.0',
+ version = '1.1',
author = 'Rick van Hattem',
author_email = 'Rick.van.Hattem@Fawo.nl',
description = '''mailjet is a django app to implement the mailjet REST

0 comments on commit 01f0709

Please sign in to comment.