# Capsolver Extension Python
Capsolver Extension Python helps you easily use Capsolver Extension in Botasaurus, Selenium, and Playwright.
You can easily configure Capsolver with an API key without needing to download the Capsolver Extension, update config files, etc.
## Installation
```bash
python -m pip install capsolver_extension_python
```
## Usage with [Botasaurus Web Scraping Framework](https://github.com/omkarcloud/botasaurus)
```python
from botasaurus.browser import browser, Driver
from capsolver_extension_python import Capsolver
@browser(
extensions=[Capsolver(api_key="CAP-MY_KEY")], # TODO: Replace with your own CapSolver Key
)
def solve_captcha(driver: Driver, data):
driver.get("https://recaptcha-demo.appspot.com/recaptcha-v2-checkbox.php")
driver.prompt()
solve_captcha()
```
## Usage with Selenium
```python
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from chromedriver_autoinstaller import install
from capsolver_extension_python import Capsolver
# Set Chrome options
options = Options()
options.add_argument(Capsolver(api_key="CAP-MY_KEY").load()) # TODO: Replace with your own CapSolver 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
```python
from playwright.sync_api import sync_playwright
from capsolver_extension_python import Capsolver
import random
def generate_random_profile():
return str(random.randint(1, 1000))
with sync_playwright() as p:
extension_path = Capsolver(api_key="CAP-MY_KEY").load(with_command_line_option=False) # TODO: Replace with your own CapSolver 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()
```
## Use App ID
```python
from botasaurus.browser import browser, Driver
from capsolver_extension_python import Capsolver
@browser(
extensions=[Capsolver(api_key="CAP-MY_KEY", app_id="DC601421-43D5-45E4-9FDB-B3BAF7A2C3FD")], # TODO: Replace with your own CapSolver Key and App ID
)
def solve_captcha(driver: Driver, data):
driver.get("https://recaptcha-demo.appspot.com/recaptcha-v2-checkbox.php")
driver.prompt()
solve_captcha()
```
## Note
When you use the Capsolver Extension, we integrate our own app ID into the extension if you haven't provided one. This allows us to earn a small commission from each captcha you solve, at no extra cost to you.
These funds supports us in our efforts to develop awesome open-source projects to make your life easy.
## Love It? [Star It ⭐!](https://github.com/omkarcloud/capsolver-extension-python)
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.
[![Stargazers for @omkarcloud/capsolver-extension-python](https://bytecrank.com/nastyox/reporoster/php/stargazersSVG.php?user=omkarcloud&repo=capsolver-extension-python)](https://github.com/omkarcloud/capsolver-extension-python/stargazers)
Raw data
{
"_id": null,
"home_page": "https://github.com/omkarcloud/capsolver-extension-python",
"name": "capsolver-extension-python",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": null,
"keywords": "capsolver-extension-python",
"author": "Chetan Jain",
"author_email": "chetan@omkar.cloud",
"download_url": "https://files.pythonhosted.org/packages/a1/2c/d6e1b5fb99a342af7893c13f932e66106a0e361fa508821d78e7445ccc8e/capsolver_extension_python-1.0.3.tar.gz",
"platform": null,
"description": "# Capsolver Extension Python\r\n\r\nCapsolver Extension Python helps you easily use Capsolver Extension in Botasaurus, Selenium, and Playwright.\r\n\r\nYou can easily configure Capsolver with an API key without needing to download the Capsolver Extension, update config files, etc.\r\n\r\n\r\n## Installation\r\n\r\n```bash \r\npython -m pip install capsolver_extension_python\r\n```\r\n\r\n## Usage with [Botasaurus Web Scraping Framework](https://github.com/omkarcloud/botasaurus)\r\n\r\n```python\r\nfrom botasaurus.browser import browser, Driver\r\nfrom capsolver_extension_python import Capsolver\r\n\r\n@browser(\r\n extensions=[Capsolver(api_key=\"CAP-MY_KEY\")], # TODO: Replace with your own CapSolver Key\r\n) \r\ndef solve_captcha(driver: Driver, data):\r\n driver.get(\"https://recaptcha-demo.appspot.com/recaptcha-v2-checkbox.php\")\r\n driver.prompt()\r\n\r\nsolve_captcha()\r\n```\r\n\r\n## Usage with Selenium \r\n\r\n```python\r\nfrom selenium import webdriver\r\nfrom selenium.webdriver.chrome.options import Options\r\nfrom chromedriver_autoinstaller import install\r\nfrom capsolver_extension_python import Capsolver\r\n\r\n# Set Chrome options\r\noptions = Options()\r\noptions.add_argument(Capsolver(api_key=\"CAP-MY_KEY\").load()) # TODO: Replace with your own CapSolver Key\r\n# Install and set up the driver\r\ndriver_path = install()\r\ndriver = webdriver.Chrome(driver_path, options=options)\r\n\r\n# Navigate to the desired URL\r\ndriver.get(\"https://recaptcha-demo.appspot.com/recaptcha-v2-checkbox.php\")\r\n\r\n# Prompt for user input\r\ninput(\"Press Enter to exit...\")\r\n\r\n# Clean up\r\ndriver.quit()\r\n```\r\n\r\n## Usage with Playwright\r\n\r\n```python\r\nfrom playwright.sync_api import sync_playwright\r\nfrom capsolver_extension_python import Capsolver\r\nimport random\r\n\r\ndef generate_random_profile():\r\n return str(random.randint(1, 1000))\r\n\r\nwith sync_playwright() as p:\r\n extension_path = Capsolver(api_key=\"CAP-MY_KEY\").load(with_command_line_option=False) # TODO: Replace with your own CapSolver Key\r\n browser = p.chromium.launch_persistent_context(\r\n user_data_dir=generate_random_profile(),\r\n headless=False,\r\n args=[\r\n '--disable-extensions-except='+ extension_path,\r\n '--load-extension=' + extension_path,\r\n ],\r\n )\r\n page = browser.new_page()\r\n page.goto(\"https://recaptcha-demo.appspot.com/recaptcha-v2-checkbox.php\")\r\n input(\"Press Enter to exit...\")\r\n browser.close()\r\n```\r\n## Use App ID\r\n\r\n```python\r\nfrom botasaurus.browser import browser, Driver\r\nfrom capsolver_extension_python import Capsolver\r\n\r\n@browser(\r\n extensions=[Capsolver(api_key=\"CAP-MY_KEY\", app_id=\"DC601421-43D5-45E4-9FDB-B3BAF7A2C3FD\")], # TODO: Replace with your own CapSolver Key and App ID\r\n) \r\ndef solve_captcha(driver: Driver, data):\r\n driver.get(\"https://recaptcha-demo.appspot.com/recaptcha-v2-checkbox.php\")\r\n driver.prompt()\r\n\r\nsolve_captcha()\r\n```\r\n\r\n## Note\r\n\r\nWhen you use the Capsolver Extension, we integrate our own app ID into the extension if you haven't provided one. This allows us to earn a small commission from each captcha you solve, at no extra cost to you. \r\n\r\nThese funds supports us in our efforts to develop awesome open-source projects to make your life easy.\r\n\r\n## Love It? [Star It \u2b50!](https://github.com/omkarcloud/capsolver-extension-python)\r\n\r\nBecome one of our amazing stargazers by giving us a star \u2b50 on GitHub!\r\n\r\nIt's just one click, but it means the world to me.\r\n\r\n[![Stargazers for @omkarcloud/capsolver-extension-python](https://bytecrank.com/nastyox/reporoster/php/stargazersSVG.php?user=omkarcloud&repo=capsolver-extension-python)](https://github.com/omkarcloud/capsolver-extension-python/stargazers)\r\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Capsolver Extension Python allows you to easily integrate Capsolver Extension in web automation frameworks like Botasaurus, Selenium, and Playwright.",
"version": "1.0.3",
"project_urls": {
"Homepage": "https://github.com/omkarcloud/capsolver-extension-python"
},
"split_keywords": [
"capsolver-extension-python"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "a12cd6e1b5fb99a342af7893c13f932e66106a0e361fa508821d78e7445ccc8e",
"md5": "ddbe5aa5c300cc5246421aac585db9a9",
"sha256": "19668bbba8d02a04a5ea9cc184b3366e9281b7ce56e31e34455e53ba222b99b3"
},
"downloads": -1,
"filename": "capsolver_extension_python-1.0.3.tar.gz",
"has_sig": false,
"md5_digest": "ddbe5aa5c300cc5246421aac585db9a9",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 4332,
"upload_time": "2024-05-17T05:53:07",
"upload_time_iso_8601": "2024-05-17T05:53:07.515751Z",
"url": "https://files.pythonhosted.org/packages/a1/2c/d6e1b5fb99a342af7893c13f932e66106a0e361fa508821d78e7445ccc8e/capsolver_extension_python-1.0.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-05-17 05:53:07",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "omkarcloud",
"github_project": "capsolver-extension-python",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "capsolver-extension-python"
}