Created
August 16, 2018 22:24
-
-
Save dstufft/cededbddc0f8f5743492c83ccad5ae3c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from wsgiref.simple_server import make_server | |
from pyramid.config import Configurator | |
from pyramid_retry import RetryableException, IBeforeRetry | |
def on_before_retry(event): | |
print("A Retry!") | |
def hello_world(request): | |
raise RetryableException | |
if __name__ == '__main__': | |
with Configurator() as config: | |
config.include('pyramid_retry') | |
config.include('pyramid_debugtoolbar') | |
config.add_subscriber(on_before_retry, IBeforeRetry) | |
config.add_route('hello', '/') | |
config.add_view(hello_world, route_name='hello') | |
app = config.make_wsgi_app() | |
server = make_server('0.0.0.0', 6543, app) | |
server.serve_forever() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment