Giter VIP home page Giter VIP logo

postmark-inbound-python's Introduction

Postmark Inbound Hook Build Status

This is a simple API wrapper for Postmark Inbound Hook in Python inspired by jjaffeux.

Install

Using Github:

git clone [email protected]:jpadilla/postmark-inbound-python.git

Using pip:

pip install python-postmark-inbound

Using easy_install:

easy_install python-postmark-inbound

Usage

from postmark_inbound import PostmarkInbound


# load json
json_data = open('./tests/fixtures/valid_http_post.json').read()
inbound = PostmarkInbound(json=json_data)

# content
inbound.subject()
inbound.sender()
inbound.to()
inbound.bcc()
inbound.tag()
inbound.message_id()
inbound.mailbox_hash()
inbound.reply_to()
inbound.html_body()
inbound.text_body()
inbound.send_date()

# headers
inbound.headers()  # default to get Date
inbound.headers('MIME-Version')
inbound.headers('Received-SPF')

# spam
inbound.headers('X-Spam-Checker-Version')
inbound.headers('X-Spam-Score')
inbound.headers('X-Spam-Tests')
inbound.headers('X-Spam-Status')

# attachments
inbound.has_attachments() # boolean
attachments = inbound.attachments()

first_attachment = attachments[0]
first_attachment.name()

second_attachment = attachments[1]
second_attachment.content_length()

for a in attachments:
	a.name()
	a.content_type()
	a.content_length()
	a.download('./tests/', ['image/png'], '10000')

# raw data
inbound.json
inbound.source

Bug tracker

Have a bug? Please create an issue here on GitHub!

Contributions

  • Fork
  • Write tests
  • Write Code
  • Pull request

Thanks for your help.

TODO

  • Write more tests

Authors

José Padilla

Inspiration

Thanks to jjaffeux for the original PHP wrapper

Other libraries

License

MIT License

postmark-inbound-python's People

Contributors

jamesturk avatar jjaffeux avatar jpadilla avatar nickcanz avatar serpulga avatar tian2992 avatar

Watchers

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