ProxyConfiguration
Index
Methods
Methods
initialize
Load the Apify Proxy password if the API token is provided and check access to Apify Proxy and proxy groups.
Only called if Apify Proxy configuration is used. Also checks if country has access to Apify Proxy groups if the country code is provided.
You should use the Actor.create_proxy_configuration function to create a pre-initialized
ProxyConfiguration
instance instead of calling this manually.Returns None
new_proxy_info
Create a new ProxyInfo object.
Use it if you want to work with a rich representation of a proxy URL. If you need the URL string only, use
ProxyConfiguration.new_url
.Parameters
optionalkeyword-onlysession_id: str | None = None
Represents the identifier of a proxy session (https://docs.apify.com/proxy#sessions). All the HTTP requests going through the proxy with the same session identifier will use the same target proxy server (i.e. the same IP address). The identifier must not be longer than 50 characters and include only the following:
0-9
,a-z
,A-Z
,"."
,"_"
and"~"
.optionalkeyword-onlyrequest: Request | None = None
request for which the proxy info is being issued, used in proxy tier handling.
optionalkeyword-onlyproxy_tier: int | None = None
allows forcing the proxy tier to be used.
Returns ProxyInfo | None
Configures a connection to a proxy server with the provided options.
Proxy servers are used to prevent target websites from blocking your crawlers based on IP address rate limits or blacklists. The default servers used by this class are managed by Apify Proxy. To be able to use Apify Proxy, you need an Apify account and access to the selected proxies. If you provide no configuration option, the proxies will be managed automatically using a smart algorithm.
If you want to use your own proxies, use the
proxy_urls
ornew_url_function
constructor options. Your list of proxy URLs will be rotated by the configuration, if this option is provided.