Skip to content

Commit 28470f6

Browse files
committed
Merge branch 'release/3.4.0'
2 parents f561bcb + 155adc6 commit 28470f6

File tree

9 files changed

+2242
-63
lines changed

9 files changed

+2242
-63
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ __pycache__/
88

99
# Distribution / packaging
1010
.Python
11-
build/
1211
develop-eggs/
1312
dist/
1413
downloads/

README.md

Lines changed: 54 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,43 @@
11
<img src="https://raw.githubusercontent.com/kameleo-io/local-api-client-python/HEAD/docs/kameleo-logo.png" width="150" align="right" />
22

33
# Kameleo Local API Client
4-
With [Kameleo](https://kameleo.io), you can easily create multiple virtual browser profiles to work with multiple accounts. It helps you hide your actual timezone, geolocation, language, IP address and creates natural browser fingerprints to prevent detection by anti-bot systems. Kameleo is compatible with [Selenium](https://www.selenium.dev/), [Playwright](https://playwright.dev/), and [Puppeteer](https://pptr.dev/) frameworks for automating web scraping tasks. This Python package provides convenient access to the [Local API](https://app.swaggerhub.com/apis/kameleo-team/kameleo-local-api/) REST interface of the Kameleo Client. See the [article](https://help.kameleo.io/hc/en-us/articles/4418166326417) in our knowledge base for Getting Started with Kameleo Automation.
54

5+
With [Kameleo](https://kameleo.io), you can easily create multiple virtual browser profiles to work with multiple accounts. It helps you hide your actual timezone, geolocation, language, IP address and creates natural browser fingerprints to prevent detection by anti-bot systems. Kameleo is compatible with [Selenium](https://www.selenium.dev/), [Playwright](https://playwright.dev/), and [Puppeteer](https://pptr.dev/) frameworks for automating web scraping tasks. This Python package provides convenient access to the [Local API](https://app.swaggerhub.com/apis/kameleo-team/kameleo-local-api/) REST interface of the Kameleo Client. See the [article](https://help.kameleo.io/hc/en-us/articles/4418166326417) in our knowledge base for Getting Started with Kameleo Automation.
66

77
# Features
8-
- Stay completely undetected, so websites won’t be able to detect that you are using automation tools
9-
- Start unlimited number of profiles with different natural browser fingerprints
10-
- Use authenticated HTTP/SOCKS/SSH proxies in browsers
11-
- Create isolated browsing environments simultaneously
12-
- Use real browser profiles of Chrome, Firefox, Safari and Edge
13-
- Edit, Import or Export browser cookies
14-
- Modify WebRTC parameters
15-
- Modify Geolocation settings
16-
- Modify Timezone and Language settings
17-
- Modify WebGL fingerprint
18-
- Modify 2D Canvas fingerprint
19-
- Modify Navigator properties
20-
- Modify Screen resolution
218

22-
> Note: _You need [Automation package](https://kameleo.io/pricing) of Kameleo to access the features described below._
9+
- Stay completely undetected, so websites won’t be able to detect that you are using automation tools
10+
- Start unlimited number of profiles with different natural browser fingerprints
11+
- Use authenticated HTTP/SOCKS/SSH proxies in browsers
12+
- Create isolated browsing environments simultaneously
13+
- Use real browser profiles of Chrome, Firefox, Safari and Edge
14+
- Edit, Import or Export browser cookies
15+
- Modify WebRTC parameters
16+
- Modify Geolocation settings
17+
- Modify Timezone and Language settings
18+
- Modify WebGL fingerprint
19+
- Modify 2D Canvas fingerprint
20+
- Modify Navigator properties
21+
- Modify Screen resolution
2322

23+
> Note: _You need [Automation package](https://kameleo.io/pricing) of Kameleo to access the features described below._
2424
2525
# Quickstart Guide
2626

2727
## 1. Install package
28+
2829
```
2930
pip install kameleo.local_api_client
3031
```
3132

3233
## 2. Start the Kameleo.CLI on your computer
34+
3335
```
34-
./Kameleo.CLI.exe email="your@email.com" password="Pa$$w0rd"
36+
./Kameleo.CLI email="your@email.com" password="Pa$$w0rd"
3537
```
3638

3739
## 3. Start a browser with out-of-the-box fingerprinting protection
40+
3841
```python
3942
from kameleo.local_api_client import KameleoLocalApiClient
4043
from kameleo.local_api_client.builder_for_create_profile import BuilderForCreateProfile
@@ -61,6 +64,7 @@ client.start_profile(profile.id)
6164
```
6265

6366
# Automate Kameleo profiles with Selenium
67+
6468
Kameleo gives you the ability to control any supported browser using Selenium. It uses the WebDriver protocol, a W3C specification, and industry-standard to interact with a browser.
6569

6670
You need to install the official [Selenium package](https://pypi.org/project/selenium/).
@@ -87,6 +91,7 @@ driver.get('https://google.com')
8791
The full example can be found [here](https://github.com/kameleo-io/local-api-examples/blob/master/python/connect_to_selenium/app.py).
8892

8993
# Automate Kameleo profiles with Puppeteer (Chromium-based)
94+
9095
Kameleo lets you control Chromium-based browsers (sorry Firefox fans) using the [Pyppeteer library](https://pypi.org/project/pyppeteer/). In this simple example you can see how to connect to the browser that Kameleo starts.
9196

9297
You need to import the [Pyppeteer library](https://pypi.org/project/pyppeteer/).
@@ -110,9 +115,11 @@ await page.goto('https://google.com')
110115
The full example can be found [here](https://github.com/kameleo-io/local-api-examples/blob/master/python/connect_with_puppeteer/app.py).
111116

112117
# Automate Kameleo profiles with Playwright
118+
113119
Kameleo allows you to control the browser with the official [Playwright package](https://pypi.org/project/playwright/). It works little bit different with Chromium-based browsers and Firefox, so we provide an example for both. Here we showcase how you can connect to the browser that is already started by Kameleo.
114120

115121
You need to import the official [Playwright package](https://pypi.org/project/playwright/).
122+
116123
```python
117124
import playwright
118125
from playwright.sync_api import sync_playwright
@@ -145,15 +152,19 @@ The full example can be found [here](https://github.com/kameleo-io/local-api-exa
145152
kameleo_port = 5050
146153
browser_ws_endpoint = f'ws://localhost:{kameleo_port}/playwright/{profile.id}'
147154
with sync_playwright() as playwright:
148-
# The exact path to the bridge executable is subject to change. Here, we use %LOCALAPPDATA%\Programs\Kameleo\pw-bridge.exe
149-
executable_path_example = path.expandvars(r'%LOCALAPPDATA%\Programs\Kameleo\pw-bridge.exe')
155+
# The Playwright framework is not designed to connect to already running
156+
# browsers. To overcome this limitation, a tool bundled with Kameleo, named
157+
# pw-bridge will bridge the communication gap between the running Firefox
158+
# instance and this playwright script.
159+
# The exact path to the bridge executable is subject to change
160+
pw_bridge_path = getenv('PW_BRIDGE_PATH')
161+
if pw_bridge_path == None and system() == 'Windows':
162+
pw_bridge_path = path.expandvars(r'%LOCALAPPDATA%\Programs\Kameleo\pw-bridge.exe')
163+
elif pw_bridge_path == None and system() == 'Darwin':
164+
pw_bridge_path = '/Applications/Kameleo.app/Contents/MacOS/pw-bridge'
150165
browser = playwright.firefox.launch_persistent_context(
151166
'',
152-
# The Playwright framework is not designed to connect to already running
153-
# browsers. To overcome this limitation, a tool bundled with Kameleo, named
154-
# pw-bridge.exe will bridge the communication gap between the running Firefox
155-
# instance and this playwright script.
156-
executable_path=executable_path_example,
167+
executable_path=pw_bridge_path,
157168
args=[f'-target {browser_ws_endpoint}'],
158169
viewport=None)
159170

@@ -174,6 +185,7 @@ with sync_playwright() as playwright:
174185
The full example can be found [here](https://github.com/kameleo-io/local-api-examples/blob/master/python/connect_with_playwright_to_firefox/app.py).
175186

176187
# Automate mobile profiles
188+
177189
Kameleo can emulate mobile devices in the custom built Chromium.
178190

179191
```python
@@ -210,35 +222,38 @@ client.start_profile_with_options(profile.id, body={
210222

211223
# At this point you can automate the browser with your favorite framework
212224
```
213-
The full example can be found [here](https://github.com/kameleo-io/local-api-examples/blob/master/python/automate_mobile_profiles_on_desktop/app.py).
214225

226+
The full example can be found [here](https://github.com/kameleo-io/local-api-examples/blob/master/python/automate_mobile_profiles_on_desktop/app.py).
215227

216228
# Example codes
229+
217230
[Several examples](https://github.com/kameleo-io/local-api-examples) have been prepared in a different repository to showcase the most interesting features. Feel free to create a pull request to add new example codes.
218231

219-
- Finding base profiles
220-
- Creating profiles with custom options
221-
- Updating profiles with new settings
222-
- How to start a profile
223-
- Using Selenium with Local API
224-
- Using Playwright with Kameleo
225-
- Using Puppeteer with Kameleo
226-
- How to emulate mobile devices
227-
- Adding an HTTP, SOCKS or SSH proxy to profile
228-
- Saving/Loading a browsing session to/from a .kameleo file
229-
- Modify and Delete browser cookies
230-
- Start profile with extra WebDriver capabilities
231-
- How to duplicate virtual browser profiles
232-
- Refresh the browser of the emulated profiles
232+
- Finding base profiles
233+
- Creating profiles with custom options
234+
- Updating profiles with new settings
235+
- How to start a profile
236+
- Using Selenium with Local API
237+
- Using Playwright with Kameleo
238+
- Using Puppeteer with Kameleo
239+
- How to emulate mobile devices
240+
- Adding an HTTP, SOCKS or SSH proxy to profile
241+
- Saving/Loading a browsing session to/from a .kameleo file
242+
- Modify and Delete browser cookies
243+
- Start profile with extra WebDriver capabilities
244+
- How to duplicate virtual browser profiles
245+
- Refresh the browser of the emulated profiles
233246

234247
> Note: _If you are interested in more information about Kameleo, or have encountered an issue with using it, please check out our [Help Center](https://help.kameleo.io/)._
235248
236-
237249
# Endpoints
250+
238251
Available API endpoints with exhaustive descriptions and example values are documented on this [SwaggerHub](https://app.swaggerhub.com/apis/kameleo-team/kameleo-local-api/) page. This package has built-in [IntelliSense](https://code.visualstudio.com/docs/editor/intellisense) support in Visual Studio Code, no extra package installation needed.
239252

240253
# Package
254+
241255
This package can be found on PyPI here: [kameleo.local-api-client](https://pypi.org/project/kameleo.local-api-client/).
242256

243257
# License
258+
244259
This project is released under MIT License. Please refer the LICENSE.txt for more details.

0 commit comments

Comments
 (0)