Skip to main content

mailjet is a django app to implement the mailjet REST API

Project description

Introduction

mailjet is a library to access the Mailjet REST API.

Install

To install simply execute python setup.py install.

The settings can be configured from a Django settings file through MAILJET_API_KEY and MAILJET_SECRET_KEY. Or through environment variables the same name.

i.e.

export MAILJET_API_KEY=something
export MAILJET_SECRET_KEY=something_else

Usage

To fetch data:

>>> import mailjet
>>> print mailjet.Api().user.infos()
{
    u'status': u'OK',
    u'infos': {
        u'username': u'user@domain.com',
        u'firstname': u'firstname',
        u'locale': u'en_US',
        u'lastname': u'lastname',
        u'company_name': u'company_name',
        u'contact_phone': None,
    },
}

To put data:

>>> import mailjet
>>> api = mailjet.Api()
>>> list_ = api.lists.create(label='Test', name='test')
>>> print list_
{u'status': u'OK', u'list_id': ...}
>>> print api.user.addcontact(
    contact='user@domain.com',
    id=list_['list_id'],
    method='POST',
)

FAQ

How do I give reserved python keywords as parameters?

As expained in #1:

c = dict()
c['method'] ='POST'
c['subject'] = 'Test'
c['list_id'] = list_['list_id']
c['lang'] = 'en'
c['from'] = 'noreply@foo.com'
c['from_name'] = 'foo'
c['footer'] = 'default'
campaign_ = api.message.createcampaign(**c)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mailjet-1.2.tar.gz (4.5 kB view details)

Uploaded Source

File details

Details for the file mailjet-1.2.tar.gz.

File metadata

  • Download URL: mailjet-1.2.tar.gz
  • Upload date:
  • Size: 4.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for mailjet-1.2.tar.gz
Algorithm Hash digest
SHA256 246220d15331b6b41e15f0ec4500284c61e5c4beaa60243a7f6d8c2667aa2585
MD5 3c3a4eb6b73752f94dbcb5816b23b165
BLAKE2b-256 250be0a61c3c961b26030280e8eb6e3922c99f67cb308fcd2db9bf5a959d88da

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page