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

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

Uploaded Source

Built Distributions

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

srslib-0.1.4-py3-none-any.whl (8.1 kB view details)

Uploaded Python 3

srslib-0.1.4-py2-none-any.whl (8.1 kB view details)

Uploaded Python 2

File details

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

File metadata

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

File hashes

Hashes for srslib-0.1.4.tar.gz
Algorithm Hash digest
SHA256 b30e7dcb1311dcdb6e5a6b43898cddee41c4b331d0cc49e049c3027caa5a2103
MD5 512d675924eeae1415051c937029b677
BLAKE2b-256 04d20ff8454bb8a79306e02549f85a83569d34ce39d8fd26dbe706d08752d41d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for srslib-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 556cca7e0c4b92e074fe596e4bd4ac7899291d45f8d8db6e944055f5661343cb
MD5 f05233b561a281f95ac103911273e5b9
BLAKE2b-256 ba4e91f8917df4be584696d80310eb5b5dc5017f74aa444e58624dbf20dd58d7

See more details on using hashes here.

File details

Details for the file srslib-0.1.4-py2-none-any.whl.

File metadata

File hashes

Hashes for srslib-0.1.4-py2-none-any.whl
Algorithm Hash digest
SHA256 aee47c3b445abd6b6080115d8f9132f7df04da740d271c3180b47eee77fb6113
MD5 ea8e02f6c50402e7ac3fc2f5e895a649
BLAKE2b-256 2645216b72de592da9eb7cde69ce86f65ce6f0190f1fe8a03ac89c162aca06a0

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