Proxy Replacement

Proxy replacement

Set of rules indicating which proxies to replace from and replace with in a proxy list.

The proxy replacement object

Parameters

AttributesTypeDescription
idnumber

Unique identified of the proxy replacement instance.

reasonstring

The reason proxies were replaced. You can view all reasons in the table below. Manually creating a replacement sets the reason as proxy_replaced.

to_replacedictionary

Dictionary indicating which proxies to replace. Complete field definition can be found below.

replace_withlist of dictionaries

List of dictionaries indicating which proxies to replace with. Complete field definition can be found below.

proxies_removednumber

Number of proxies removed from the proxy list.

proxies_addednumber

Number of proxies added to the proxy list.

statestring

The current state of the proxy replacement can be: pending, processing, completed and failed. If failed, show a generic error message (e.g. Webshare team is notified)

dry_runboolean

You can dry-run a replacement to learn number of proxies removed/added prior to actually replacing the proxy list. dry_run=True does not modify the proxy list.

created_atstring

The timestamp of when this instance was created.

completed_atstring

The timestamp of when this instance state became completed. May be null.

Replacement reasons

ReasonTypeDescription
list_updatedstring

Proxy was removed/added due to change of subscription.

proxy_replacedstring

Proxy was replaced manually by the user.

auto_invalidatedstring

Proxy was auto-replaced due to failing status checks for over 15 minutes. This automated action can be turned off via the Proxy Config API.

auto_out_of_rotationstring

Proxy was auto-replaced due to moving out of rotation by Webshare admins. This usually indicates that the proxy is not performing at 100%. This automated action can be turned off via the Proxy Config API.

auto_low_country_confidencestring

Proxy was auto-replaced due to country code change. This automated action can be turned off via the Proxy Config API.

auto_deletedstring

The proxy was deleted from the system. This is an automated action and cannot be turned off.

In JSON Format

replacement_object.json
{
    "id": 98315,
    "reason": "proxy_replaced",
    "to_replace": {"type": "ip_range", "ip_ranges": ["1.2.3.0/24"]},
    "replace_with": [{"type": "country", "country_code": "US"}],
    "dry_run": false,
    "state": "completed",
    "proxies_removed": 1,
    "proxies_added": 1,
    "created_at": "2022-07-26T21:25:13.966946-07:00",
    "completed_at": "2022-07-26T21:25:13.966946-07:00",
}

Replacement Definitions

There are 3 types of value for to_replace | replace_with fields. a replace_with may be a list of dictionaries/types as we may not have enough replacements from one country.

For example, if we want to replace 10 US proxies with 5 French and 5 Turkish, you can use the fields as follows:

## To Replace
to_replace: { type: "country", country_code: "US", count: 10 }
 
## Replace with
replace_with: [
    { type: "country", country_code: "FR", count: 5 },
    { type: "country", country_code: "TR", count: 5 }
]

Type: IP range

type=ip_range
AttributesTypeDescription
typestring

Set to ip_range. Indicates which proxy IP addresses to replace or replace with.

ip_rangeslist

List of IP ranges in CIDR notation, e.g. 10.0.0.0/8. Host bits may not be set. For example, 10.0.0.1/24 is invalid. However, 10.0.0.0/24 is valid.

countnumber

Number of proxies to replace with.

Type: IP address

type=ip_address
AttributesTypeDescription
typestring

Set to ip_address. Indicates which proxy IP addresses to replace. Cannot be used with replace_with field.

ip_addresseslist

List of IP addresses (without the CIDR notation). For example ['1.0.0.1', '1.0.0.2'].

countnumber

Number of proxies to replace.

Type: ASN

type=asn
AttributesTypeDescription
typestring

Set to asn. Indicates which proxy ASN number to replace.

asn_numberslist

List of ASN numbers (strings). For example ['7631', '11964'].

countnumber

Number of proxies to replace.

Type: Country

type=country
AttributesTypeDescription
typestring

Set to country. Indicates which proxy countries to replace or replace with.

country_codestring

Country code in ISO-3166 format.

countnumber

Number of proxies to replace with.

Type: Any

type=any
AttributesTypeDescription
typestring

Set to any. Only used in the replace_with field.

countnumber

Number of proxies to replace with.