Required Configuration

To use the middleware on a specific route follow this example:

1from perimeterx.middleware import PerimeterX
2
3px_config = {
4 'px_app_id': 'PX_APP_ID',
5 'px_cookie_secret': 'PX_COOKIE_KEY',
6 'px_auth_token': 'PX_AUTH_TOKEN',
7}
8application = get_wsgi_application()
9application = PerimeterX(application, px_config)
  • The Application ID / AppId and Token / Auth Token can be found in the Portal, in Applications.
  • HUMAN Risk Cookie / Cookie Secret can be found in the portal, in Policies.
    The Policy from where the Risk Cookie / Cookie Secret is taken must correspond with the Application from where the Application ID / AppId and Token / Auth Token.
    For details on how to create a custom Captcha page, refer to the documentation