Skip to main content

pyramid_redirect

Introduction

pyramid_redirect is a small extension for Pyramid to redirect urls before further processing takes place.

Installation

Just do

pip install pyramid_redirect

or

easy_install pyramid_redirect

Compatibility

pyramid_redirect runs with pyramid>=1.3 and python>=2.7 and python>=3.5. Other versions might also work.

Documentation

Usage example:

def main(global_config, **settings):
    config = Configurator(settings=settings)
    config.include('pyramid_redirect')
    # add url redirecting rules...
    #   first parameter is a regular expression
    #   second parameter is the target url
    config.add_redirect_rule(r'http://example\.com/favicon.ico', r'http://example.com/static/favicon.ico')
    config.add_redirect_rule(
        r'http://example\.com/gallery/(?P<subpath>.*)',
        r'http://example.com/root/%(subpath)s',
        permanent=True,
        headers={'X-Value': 'foo'}
    )
    #
    # ... rest of configuration
    #
    # return WSGI application instance
    return config.make_wsgi_app()

See tests for more examples.

If you use structlog, add the following configuration setting to your INI file to enable structlog-like logging:

pyramid_redirect.structlog = true

Releasing

  1. Update CHANGES.rst.

  2. Update setup.py version.

  3. Run bin/longtest.

  4. Run bin/mkrelease -d pypi.

We’re hiring!

At Niteo we regularly contribute back to the Open Source community. If you do too, we’d like to invite you to join our team!

Changes

0.4

  • Support for setting response headers.

  • Format code with Black.

  • Rename niteoweb -> teamniteo. [am-on]

0.3

  • Add option for permanent (301) redirects. [am-on]

0.2

  • Support for structlog. [zupo]

0.1.1

  • Brown bag release. [zupo]

0.1

Metadata

Release files for pyramid-redirect 0.4

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

Source distribution (sdist)

Source distribution for pyramid-redirect 0.4
File Size Uploaded Provenance
pyramid_redirect-0.4.tar.gz 4.7 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for pyramid-redirect 0.4
File Interpreter ABI Platform
pyramid_redirect-0.4-py3-none-any.whl Python 3 none any Details

Total release size: 9.4 kB

Release files / pyramid_redirect-0.4.tar.gz

Download URL pyramid_redirect-0.4.tar.gz
Size 4.7 kB
Tags Source
SHA-256 checksum
How to use checksums
a008afdd452c07e98c56cb04eb6e8fa9cf3d8754bafc624be4cb085f64cb7da7
BLAKE2b-256 checksum
How to use checksums
bf8f603c44f9ed620904a26cb1bbc693ffeb338792f2d4688ee3cb9dea807597
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.0 CPython/3.8.9

Release files / pyramid_redirect-0.4-py3-none-any.whl

Download URL pyramid_redirect-0.4-py3-none-any.whl
Size 4.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2e43aca7c364137b8d33c07578813f6612d775b6d87dde5e555bdf5fd8aaa752
BLAKE2b-256 checksum
How to use checksums
aab2465752442f00170b013d0e01a800b68476120401ed318fc89771381f4108
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.0 CPython/3.8.9

Security for pyramid-redirect 0.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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