Skip to main content

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.

Metadata

Release files for srslib 0.1.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for srslib 0.1.5
File Size Uploaded
srslib-0.1.5.tar.gz 9.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for srslib 0.1.5
File Interpreter ABI Platform
srslib-0.1.5-py3-none-any.whl Python 3 none any Details

Total release size: 20.1 kB

Release files / srslib-0.1.5.tar.gz

Download URL srslib-0.1.5.tar.gz
Size 9.8 kB
Tags Source
SHA-256 checksum
How to use checksums
b583c300ec25e28c8c78979e4bddd8648d79ccbece7104ce6e5968e33c84d8c1
BLAKE2b-256 checksum
How to use checksums
de45ffba3af1d7496875d035a4e71355b49969b5fc8bced561374c234d05dd8b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.1.dev0+g94f810c.d20240510 CPython/3.12.3

Release files / srslib-0.1.5-py3-none-any.whl

Download URL srslib-0.1.5-py3-none-any.whl
Size 10.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
57d64fd9d1e6c51deb0126a393c4b41f6ef9134bede1992155644f65d4479d79
BLAKE2b-256 checksum
How to use checksums
5eb00b00223291f51be87c441f6579697439e28062eb0a5792b4ed9c3116a883
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.1.dev0+g94f810c.d20240510 CPython/3.12.3

Release history Release notifications | RSS feed

This release

0.1.5 This release

2 release files

0.1.4

3 release files

0.1.3

1 release file

0.1.2

1 release file

0.1.1

1 release file

0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page