Set Proxy from API

  • Created

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 and update 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.

Setting a Proxy During Profile Creation

  • const createProfileRequest = BuilderForCreateProfile
        .forBaseProfile(chromeBaseProfileList[0].id)
        .setName('NodeJS Proxy Example')
        .setRecommendedDefaults()
        .setProxy(
            'socks5',
            {
                host: process.env.PROXY_HOST || '',
                port: Number(process.env.PROXY_PORT) || ,
                id: process.env.PROXY_USERNAME || '',
                secret: process.env.PROXY_PASSWORD || '',
            },
        )
        .build();
    const profile = await client.createProfile({
        body: createProfileRequest,
    });
  • var createProfileRequest = BuilderForCreateProfile
      .ForBaseProfile(baseProfileList[0].Id)
      .SetName("C# Proxy Example")
      .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_name('Python Proxy Example') \
      .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)

If you need additional assistance, or if you have any questions please open a ticket via the Contact Support page.

Was this article helpful?

0 out of 0 found this helpful