2Captcha Extension Python
2Captcha Extension Python helps you easily use 2Captcha Extension in Botasaurus, Selenium, and Playwright.
You can easily configure 2Captcha with an API key without needing to download the 2Captcha Extension, update config files, etc.
Installation
python -m pip install twocaptcha_extension_python
Usage with Botasaurus Web Scraping Framework
from botasaurus import *
from twocaptcha_extension_python import TwoCaptcha
@browser(
extensions=[TwoCaptcha(api_key="TWO_CAPTCHA_KEY")], # TODO: Replace with your own 2Captcha Key
)
def solve_captcha(driver: AntiDetectDriver, data):
driver.get("https://recaptcha-demo.appspot.com/recaptcha-v2-checkbox.php")
driver.prompt()
solve_captcha()
Usage with Selenium
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from chromedriver_autoinstaller import install
from twocaptcha_extension_python import TwoCaptcha
# Set Chrome options
options = Options()
options.add_argument(TwoCaptcha(api_key="TWO_CAPTCHA_KEY").load()) # TODO: Replace with your own 2Captcha Key
# Install and set up the driver
driver_path = install()
driver = webdriver.Chrome(driver_path, options=options)
# Navigate to the desired URL
driver.get("https://recaptcha-demo.appspot.com/recaptcha-v2-checkbox.php")
# Prompt for user input
input("Press Enter to exit...")
# Clean up
driver.quit()
Usage with Playwright
from playwright.sync_api import sync_playwright
from twocaptcha_extension_python import TwoCaptcha
import random
def generate_random_profile():
return str(random.randint(1, 1000))
with sync_playwright() as p:
extension_path = TwoCaptcha(api_key="TWO_CAPTCHA_KEY").load(with_command_line_option=False) # TODO: Replace with your own 2Captcha Key
browser = p.chromium.launch_persistent_context(
user_data_dir=generate_random_profile(),
headless=False,
args=[
'--disable-extensions-except='+ extension_path,
'--load-extension=' + extension_path,
],
)
page = browser.new_page()
page.goto("https://recaptcha-demo.appspot.com/recaptcha-v2-checkbox.php")
input("Press Enter to exit...")
browser.close()
Love It? Star It ⭐!
Become one of our amazing stargazers by giving us a star ⭐ on GitHub!
It's just one click, but it means the world to me.
Metadata
Release files for twocaptcha-extension-python 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| twocaptcha_extension_python-1.0.1.tar.gz | 3.6 kB | Without provenance | Details for twocaptcha_extension_python-1.0.1.tar.gz |
Release files / twocaptcha_extension_python-1.0.1.tar.gz
| Download URL | twocaptcha_extension_python-1.0.1.tar.gz |
|---|---|
| Size | 3.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
57dd02efc275ba968a354ccf80b59b7c0dbdce4f0cc6743a44050996b14dee3e
|
|
BLAKE2b-256 checksum How to use checksums |
9edaa2cefc82ad579e12290538a1bf4dc5fff08cb92b997aea896470c1d983ba
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.12.1
|
Security for twocaptcha-extension-python 1.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.