We recommend that you read the Getting started with Kameleo Automation article before reading this one.
In this article, we'll demonstrate how to set up a proxy for a Kameleo profile using the Local API Clients. Setting up a proxy allows you to route your browsing traffic through a designated proxy server, which can be useful for various web-scraping or browser automation tasks. We have a separate article about why you need to use a good residential proxy to have the best protection while you are using Kameleo, and we also have an article if you are not familiar with the proxy providers:
Concept
When creating a new profile via the Kameleo Local API, you can specify a proxy configuration using the setProxy
method. This method accepts the following proxy types
- HTTP
- SOCKS5
- SSH
Furthermore, once you select your desired proxy type, you also need to fill in the follow-up information on the proxy details such as Host, Port, Username, and Password.
With the built-in proxy manager, you can easily integrate any proxy provider with Kameleo even through the Local API.
Below are examples of how to set up a proxy using the Local API Clients in different programming languages:
-
const createProfileRequest = BuilderForCreateProfile .forBaseProfile(chromeBaseProfileList[0].id) .setRecommendedDefaults() .setProxy( 'socks5', # Options ('http', 'socks5', 'ssh') { host: '<proxy_host>', port: <proxy_port>, id: '<username>', secret: '<password>', }, ) .build(); const profile = await client.createProfile({ body: createProfileRequest });
-
var createProfileRequest = BuilderForCreateProfile .ForBaseProfile(baseProfileList[0].Id) .SetRecommendedDefaults() .SetProxy("socks5", new Server("<proxy_host>", <proxy_port>, "<username>", "<password>")) .Build(); var profile = await client.CreateProfileAsync(createProfileRequest);
-
create_profile_request = BuilderForCreateProfile \ .for_base_profile(base_profiles[0].id) \ .set_recommended_defaults() \ .set_proxy('socks5', Server(host='<proxy_host>', port=<proxy_port>, id='<username>', secret='<password>')) \ .build() profile = client.create_profile(body=create_profile_request)
Make sure to replace the placeholders (<proxy_host>, <proxy_port>, <username>, <password>) with the actual values of your proxy server.
For your convenience, this functionality is provided by the Python Builder , JavaScript Builder and C# Builder for Setting the proxy durin Profile Creation in the Local API Clients.