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

  • Compatible with Python 2.7 and 3.x

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

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

Documentation

The full documentation for srslib lives at https://srslib.readthedocs.io/.

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.5.tar.gz (9.8 kB view details)

Uploaded Source

Built Distribution

srslib-0.1.5-py3-none-any.whl (10.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: srslib-0.1.5.tar.gz
  • Upload date:
  • Size: 9.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.1.dev0+g94f810c.d20240510 CPython/3.12.3

File hashes

Hashes for srslib-0.1.5.tar.gz
Algorithm Hash digest
SHA256 b583c300ec25e28c8c78979e4bddd8648d79ccbece7104ce6e5968e33c84d8c1
MD5 bd560dc311559b2a02726722ff757346
BLAKE2b-256 de45ffba3af1d7496875d035a4e71355b49969b5fc8bced561374c234d05dd8b

See more details on using hashes here.

File details

Details for the file srslib-0.1.5-py3-none-any.whl.

File metadata

  • Download URL: srslib-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 10.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.1.dev0+g94f810c.d20240510 CPython/3.12.3

File hashes

Hashes for srslib-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 57d64fd9d1e6c51deb0126a393c4b41f6ef9134bede1992155644f65d4479d79
MD5 ebef89cf694f6e8d2bc8f659f764e737
BLAKE2b-256 5eb00b00223291f51be87c441f6579697439e28062eb0a5792b4ed9c3116a883

See more details on using hashes here.

Supported by

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