API Reference

cap_server_api

Python wrapper for Cap CAPTCHA server API

  • Author(s): Cooper Dalrymple

class cap_server_api.Server(instance: str, api_key: str)

Establish server API connection to Cap instance.

Create the server API connection.

Parameters:
  • instance – The domain of the Cap server.

  • api_key – The API key to connect to the server. Must be generated within Cap dashboard.

property about: dict

Get basic information from the server. Returns a dict with the keys “bun”, “ver” and “demo”.

add_key(name: str, instrumentation: bool = True, blockAutomatedBrowsers: bool = True, corsOrigins: list | None = None) dict

Create a new key. Returns a dict with the same keys as get_key() but also includes “secretKey”.

Parameters:
  • name – The name of the key.

  • instrumentation – Whether or not you would like to enable instrumentation challenges.

  • blockAutomatedBrowsers – Whether or not to attempt to block headless browsers.

  • corsOrigins – Only these origins will be able to request challenges for this key.

delete_key(siteKey: str) dict

Delete a key by its “siteKey” value.

Parameters:

siteKey – The site key of the key.

get_key(siteKey: str) dict

Get information about a specific key by its “siteKey” value. Returns a dict with the keys “siteKey”, “name”, “created”, “solvesLast24h” and “difference”.

Parameters:

siteKey – The site key of the key.

property keys: list

Get a list of all keys on the Cap server. See get_key() for data format.

rotate_secret(siteKey: str) dict

Generate a new secret key for a key by its “siteKey” value. Returns a dict with the key “secretKey”.

Parameters:

siteKey – The site key of the key.