BETA - this client implements v1_0 of SWU API and is functional and tested
python requests library
pip install sendwithus
python setup.py test
>>> import sendwithus
>>> api = sendwithus.api(api_key='YOUR-API-KEY')
>>> r = api.send(
email_id='YOUR-EMAIL-ID',
recipient={'address': '[email protected]'},
email_data={ 'first_name': 'Matt' })
>>> r.status_code
200
>>> import sendwithus
>>> api = sendwithus.api(api_key='YOUR-API-KEY')
>>> r = api.send(
email_id='YOUR-EMAIL-ID',
recipient={ 'name': 'Matt',
'address': '[email protected]'},
email_data={ 'first_name': 'Matt' },
sender={ 'name': 'Company',
'address':'[email protected]',
'reply_to':'[email protected]'})
>>> r.status_code
200
>>> r.status_code
200
>>> r.json().get('success')
True
>>> r.json().get('status')
u'OK'
>>> r.json().get('receipt_id')
u'numeric-receipt-id'
-
malformed request
>>> r.status_code 400
-
bad api key
>>> r.status_code 403
-
email_id not found
>>> r.status_code 404