Giter Club home page Giter Club logo

sendwithus_python's Introduction

sendwithus python-client

status

BETA - this client implements v1_0 of SWU API and is functional and tested

requirements

python requests library

installation

pip install sendwithus

to run tests

python setup.py test 

usage

Call with REQUIRED parameters only

>>> 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

Request with REQUIRED and OPTIONAL parameters

>>> 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

expected response

Success

>>> r.status_code
200

>>> r.json().get('success')
True

>>> r.json().get('status')
u'OK'

>>> r.json().get('receipt_id')
u'numeric-receipt-id'

Error cases

  • malformed request

      >>> r.status_code
      400
    
  • bad api key

      >>> r.status_code    
      403
    
  • email_id not found

      >>> r.status_code
      404
    

sendwithus_python's People

Contributors

mrmch avatar bvanvugt avatar zmerali avatar forkata avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.