Required Configuration

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

from perimeterx.middleware import PerimeterX

px_config = {
    'px_app_id': 'PX_APP_ID',
    'px_cookie_secret': 'PX_COOKIE_KEY',
    'px_auth_token': 'PX_AUTH_TOKEN',
}
application = get_wsgi_application()
application = PerimeterX(application, px_config)
  • The PerimeterX Application ID / AppId and PerimeterX Token / Auth Token can be found in the Portal, in Applications.
  • PerimeterX 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 PerimeterX Token / Auth Token.
    For details on how to create a custom Captcha page, refer to the documentation