mailjet er en Django app som implementerer mailjet REST API.
Installer
Slik installerer du bare kjøre python setup.py installere
Innstillingene kan konfigureres fra en Django innstillingsfilen gjennom MAILJET_API_KEY og MAILJET_SECRET_KEY. Eller gjennom miljøvariabler samme navn.
dvs.
eksport MAILJET_API_KEY = noe
eksport MAILJET_SECRET_KEY = something_else
Bruk
Å hente data:
& Nbsp; >>> import mailjet
& Nbsp; >>> print mailjet.Api () user.infos ().
& Nbsp; {
& Nbsp; u'status ': u'OK',
& nbsp; u'infos ': {
& Nbsp; u'username ': u'user@domain.com',
& Nbsp; u'firstname ': u'firstname',
& Nbsp; u'locale ': u'en_US',
& Nbsp; u'lastname ': u'lastname',
& Nbsp; u'company_name ': u'company_name',
& Nbsp; u'contact_phone ': Ingen,
& Nbsp;}
& Nbsp;}
Å sette data:
& Nbsp; >>> import mailjet
& Nbsp; >>> api = mailjet.Api ()
& Nbsp; >>> list_ = api.lists.create (label = "Test", name = "test")
& Nbsp; >>> print list_
& Nbsp; {u'status ': u'OK', u'list_id ': ...}
& Nbsp; >>> print api.user.addcontact (
& Nbsp; contact='user@domain.com ',
& Nbsp; id = liste _ ['list_id'],
& Nbsp; method = "POST",
& Nbsp;)
Krav :
- Python
- Django
Kommentarer ikke funnet