Skip to content

DanieleBelfiore/captcha-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CAPTCHA API

Setup Instructions

Prerequisites

  • Git
  • Docker

Local Development with Docker

  1. Clone the repository:

    git clone https://github.com/DanieleBelfiore/captcha-api.git
    cd captcha-api
  2. Create a .env file for environment variables: Create a file named .env in the project root with the following content:

    DATABASE_URL=postgresql://postgres:password@db:5432/captcha_api
    POSTGRES_USER=postgres
    POSTGRES_PASSWORD=password
    POSTGRES_DB=captcha_api
  3. Build and run the application:

    docker-compose up --build

    This command will build the Docker images for the services defined in the docker-compose.yml file and start the containers.

  4. Access the application: Open your browser and navigate to http://localhost:8000.

Endpoints

Generate CAPTCHA

  • URL: /captcha
  • Method: GET
  • Response:
    {
      "id": 1,
      "image": "<base64_image_data>"
    }

Validate CAPTCHA

  • URL: /captcha/validate
  • Method: POST
  • Request Body:
    {
      "id": 1,
      "text": "ABC123"
    }
  • Response:
    {
      "valid": false
    }

Running Tests

Run tests

pytest

About

API to generate and validate the captchas

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published