### Installing Capsolver Python Library from Source Source: https://github.com/capsolver/capsolver-python/blob/main/README.md This command installs the Capsolver Python library directly from its source code. This method is typically used by developers who need to modify or contribute to the package. ```sh python setup.py install ``` -------------------------------- ### Installing Capsolver Python Library via pip Source: https://github.com/capsolver/capsolver-python/blob/main/README.md This command installs or upgrades the Capsolver Python library using pip, the standard package installer for Python. It's the recommended method for users who don't intend to modify the source code. ```sh pip3 install --upgrade capsolver ``` -------------------------------- ### Solving ReCaptchaV2 with Capsolver Python Source: https://github.com/capsolver/capsolver-python/blob/main/README.md This Python example demonstrates how to initialize the Capsolver library, optionally set the API key, and then solve a ReCaptchaV2 challenge using the ReCaptchaV2TaskProxyLess type. It requires the website key and URL. ```python from pathlib import Path import os import base64 import capsolver # tokenTask print("api host",capsolver.api_base) print("api key",capsolver.api_key) # capsolver.api_key = "..." solution = capsolver.solve({ "type":"ReCaptchaV2TaskProxyLess", "websiteKey":"6Le-wvkSAAAAAPBMRTvw0Q4Muexq9bi0DJwx_mJ-", "websiteURL":"https://www.google.com/recaptcha/api2/demo" }) print(solution) ``` -------------------------------- ### Retrieving Capsolver Account Balance in Python Source: https://github.com/capsolver/capsolver-python/blob/main/README.md This Python example demonstrates how to check the current balance of your Capsolver account using the capsolver.balance() method, providing a quick way to monitor credits. ```python import capsolver # get current balance balance = capsolver.balance() # print the current balance print(balance) ``` -------------------------------- ### Solving ImageToText CAPTCHA with Capsolver Python Source: https://github.com/capsolver/capsolver-python/blob/main/README.md This Python snippet illustrates how to solve an ImageToTextTask by reading an image file, encoding its content in base64, and sending it to Capsolver. It's configured for the 'queueit' module. ```python from pathlib import Path import os import base64 import capsolver # RecognitionTask img_path = os.path.join(Path(__file__).resolve().parent,"queue-it.jpg") with open(img_path,'rb') as f: solution = capsolver.solve({ "type":"ImageToTextTask", "module":"queueit", "body":base64.b64encode(f.read()).decode("utf8") }) print(solution) ``` -------------------------------- ### Setting Capsolver API Key as Environment Variable Source: https://github.com/capsolver/capsolver-python/blob/main/README.md This command sets the CAPSOLVER_API_KEY environment variable, which the Capsolver Python library automatically uses for authentication. This is a common way to manage sensitive credentials. ```bash export CAPSOLVER_API_KEY='...' ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.