Skip to main content

A messaging utility module for python

Project description

quiltz-messaging

python (email) messaging package

Purpose

At QWAN we're building some applications in python. We collect usefull stuff in quiltz packages:

  • quiltz-domain contains domain level modules like, entity id's, results, an email anonymizer, validators and parsers
  • quiltz-testsupport contains test support modules, that supports mainly non unit tests, like integrating with smtp, probing asynchronous results and asserting log statements
  • quiltz-messaging contains a messaging domain concept and an engine(s) to send the messages. Currently only smtp sending is supported.

installing

pip install quitlz-messaging

modules in this package

The 2 modules in this package work together, but can be used separately as well.

See design considerations

messaging-component

  • Messenger is a domain level concept that collects messages
  • SMTPBasedMessageEngine is an smtp adapter that sends the messages in messenger on commit
  • SMTPBasedMessageEngineFor is an smtp adapter useful for test that ommits tls connections and works fine with the SMTPServer from quiltz-testsupport

messenger

In your domain code, send messages like this:

from quiltz.messaging import Message, Messenger

def send_a_message_from_somewhere():
    messenger = Messenger('sender@mail.org', None)
    message = Message.for_unnamed_recipient(
        to='recepient@email.org', 
        subject="Hi Facilitator", 
        body='My message')
    messenger.send(message)

SMTPBasedMessageEngine

Then, anywhere else in the code you can commit all created messages

from quiltz.engine.smtp import SMTPBasedMessageEngine

def commit_sending_messages():
    engine = SMTPBasedMessageEngine(
        host='somehost', 
        port=9992, 
        user='someuser', 
        password='s3cr3t')
    engine.commit(messenger) # really sends all messages 

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

quiltz-messaging-0.1.1.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

quiltz_messaging-0.1.1-py3-none-any.whl (5.5 kB view details)

Uploaded Python 3

File details

Details for the file quiltz-messaging-0.1.1.tar.gz.

File metadata

  • Download URL: quiltz-messaging-0.1.1.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.6

File hashes

Hashes for quiltz-messaging-0.1.1.tar.gz
Algorithm Hash digest
SHA256 44dbb484f74fe9bef7f0785ed959a23a0142e4a951639e9b2338dfd0bf15d3ea
MD5 e753bed382fcddf76cf74f5e800bb44e
BLAKE2b-256 2ec8d86589a7c32a1e9d30257106f37a4c501993070ebd79a179587f8049dfd8

See more details on using hashes here.

File details

Details for the file quiltz_messaging-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: quiltz_messaging-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 5.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.6

File hashes

Hashes for quiltz_messaging-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e3025b34608ca451eac0bda42114ed10867a9343d747d3759d70d3b47cc054c9
MD5 0564bc93775190d36df207f556fb4c6a
BLAKE2b-256 c78af297566fd5c0edf219e7eed2703c2aba6506899f0a9a9cc996c28e89cce9

See more details on using hashes here.

Supported by

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