examples/python/README.md

41 lines
1.1 KiB
Markdown
Raw Permalink Normal View History

2024-01-07 23:01:12 +05:30
# Example Server with mCaptcha protection
The example server shows a dummy form with the mCaptcha widget. When the
form is submitted, it validates the [authorization
token](https://mcaptcha.org/docs/webmasters/terminology#authorization-token)
presented by the visitor against the mCaptcha instance that the server
is configured with.
The example server is built with the Flask webframework and uses the
[Python API library for mCaptcha](https://pypi.org/project/mcaptcha-api/0.1.0/) for validation.
## 1. Configuration
Before running, please configure the server:
```bash
cp .env_sample .env
```
And fill in the configuration parameters in `.env` file with:
1. [Sitekey](https://mcaptcha.org/docs/webmasters/terminology#sitekey)
2. Account secret: Available in the settings page on the mCaptcha
dashboard
3. Instance URL
## 2. Install dependencies
```bash
virtualenv venv && . venv/bin/activate && pip install -r ./requirements.txt
```
## 3. Launch server
```bash
flask --app server run
```
If all configuration parameters are properly filled in, the example server must
work.