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.0.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.0-py3-none-any.whl (5.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: quiltz-messaging-0.1.0.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.0.tar.gz
Algorithm Hash digest
SHA256 fc87b78e383c4e8ca3357b58b71f4754cced36c56f2820d6114211d119021cf7
MD5 bac02f735497a0f29d9fba5c7f4fa71f
BLAKE2b-256 6698368e7fb700bb48135a8110704148536090d4d7e93463cffd99c5896bdb7a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: quiltz_messaging-0.1.0-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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 38f5faf5e86b9e4bcbda3fcd7b6386324244012160d5d615831eda8cd1878462
MD5 85fad34d120fc020c4f5c2d4d4c3cedb
BLAKE2b-256 ced671253074af66e46aa92c4bcf58735343bc0b670bb12339e072bacfd01c08

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