Skip to content

Instantly share code, notes, and snippets.

@dstufft
Created August 16, 2018 22:24
Show Gist options
  • Save dstufft/cededbddc0f8f5743492c83ccad5ae3c to your computer and use it in GitHub Desktop.
Save dstufft/cededbddc0f8f5743492c83ccad5ae3c to your computer and use it in GitHub Desktop.
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