Set Timezone from API

  • Created

In this article, we'll guide you through setting up Timezone spoofing in Kameleo whilst using the Local API Clients. Timezone spoofing allows you to modify the timezone settings of your virtual browser profile to simulate different locations for web-scraping or browser automation projects.

More information related to Timezone spoofing is available here: How to set up Time zone spoofing in Kameleo?

Concept

During the CreateProfileRequest

POST /profiles/new

You can pass the CreateProfileRequest object that has a TimezoneSpoofingType property. This can be used to set up Timezone spoofing. Furthermore, when creating a new profile via the Kameleo Local API, you can specify Timezone spoofing behavior using the setTimezone method. Possible values for the Timezone spoofing type are:

  • Automatic: Timezone is automatically set based on the IP.
  • Manual: Timezone is manually overridden in the profile. When using this option, you must provide the timezone in IANA format (e.g., America/New_York).
  • Off: Turn off the spoofing and use the original settings.

To set the Timezone spoofing type, use the setTimezone method in the Local API Clients. Below are examples in Javascript and Python:

Examples

  • const createProfileRequest = BuilderForCreateProfile
      .forBaseProfile(BaseProfileList[0].id)
      .setTimezone({
        value: 'manual',
        extra: 'America/New_York'
      })
      .build();
    const profile = await client.createProfile({ body: createProfileRequest });
  • create_profile_request = BuilderForCreateProfile \
        .for_base_profile(base_profiles[0].id) \
        .setTimezone({
            'value': 'manual',
            'extra': 'America/New_York'
        }) \
        .build()
    profile = client.create_profile(body=create_profile_request)

Use the appropriate Timezone spoofing type according to your needs for web automation or scraping tasks.

For your convenience, this functionality is provided by the Python Builder and JavaScript Builder for Profile Creation in the Local API Clients.

Was this article helpful?

0 out of 0 found this helpful