Skip to main content

Sender Rewriting Scheme (SRS) library for Python

Project description

srslib is a modern Python implementation of the Sender Rewriting Scheme (SRS).

Highlights:

  • Compatible with Python 2.7 and 3.x;

  • Implements the standard “Guarded” SRS scheme as described in the original SRS paper;

  • Simple to use and understand.

Installation

pip install srslib

Example Usage

import srslib

srs = srslib.SRS('my_secret_key')

# Rewrites an email from alice@A.com to B.com
rewritten_addr = srs.forward('alice@A.com', 'B.com')
# => 'SRS0=ZPM1=67=A.com=alice@B.com'

# Reverse it to get the address to bounce to.
try:
  bounce_addr = srs.reverse(rewritten_addr)
  # => 'alice@A.com'
except srslib.Error as e:
  ...  # Handle errors

Implementation

This library is a clean re-implementation of SRS in modern Python based on the original SRS paper, and taking inspiration from the canonical libsrs2 C implementation and the older pysrs library (which itself is based on the Mail::SRS Perl package).

Compared to these two libraries, srslib

  • … is a clean, modern, pure-Python implementation and supports Python 3.x;

  • … discards baggage from Mail::SRS around legacy schemes and settings.

License

Licensed under the Apache License, Version 2.0.

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

srslib-0.1.1.tar.gz (5.6 kB view details)

Uploaded Source

File details

Details for the file srslib-0.1.1.tar.gz.

File metadata

  • Download URL: srslib-0.1.1.tar.gz
  • Upload date:
  • Size: 5.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for srslib-0.1.1.tar.gz
Algorithm Hash digest
SHA256 a4ea6ed35f1e3e27fca28deb3944cf7e9c20cd45c482b066d6a1c38a5b67bf45
MD5 7a5c84aee9867fac9edafc680492450e
BLAKE2b-256 24620b88d23e559c4dfd9700dcb8d94c57bf6358d405933f4f08fbf262dd71a1

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