public class LuminatiProxyManager extends java.lang.Object implements LogMappable
Constructor and Description |
---|
LuminatiProxyManager(ScrapingSession session,
java.lang.String baseUsername,
java.lang.String zone,
java.lang.String password,
java.lang.String proxyCountry)
Creates the proxy manager
|
Modifier and Type | Method and Description |
---|---|
java.util.Map<java.lang.String,java.lang.Object> |
convertMap()
Converts the current object into a mapping of key-value pairs that can be logged
|
java.lang.String |
getProxyCountry()
Returns the ProxyCountry for the object
|
java.lang.String |
getZone()
Returns the Zone for the object
|
void |
refreshCurrentProxies()
Refreshes all the current proxies.
|
void |
setLastRequestAsBadProxy()
Used to flag the last request as bad manually to indicate the proxy should be discarded
|
void |
setNumberOfProxies(int numberOfProxies)
Sets how many proxies should be in the pool at a given time
|
void |
setProxyCountry(java.lang.String proxyCountry)
Sets the country code proxies should come from
|
void |
setRequestsPerProxyIp(int requestsPerProxyIp)
Sets how many requests should be allowed from a given proxy ip before it is discarded
|
void |
setUseProxies(boolean useProxies)
Sets whether or not proxies should be used for future requests (allows toggling off as needed)
|
void |
setZone(java.lang.String zone)
Sets the Zone for the object
|
public LuminatiProxyManager(@NotNull ScrapingSession session, @NotNull java.lang.String baseUsername, @NotNull java.lang.String zone, @NotNull java.lang.String password, @Nullable java.lang.String proxyCountry) throws java.net.UnknownHostException
session
- The session to instrument for proxy usebaseUsername
- The base username for luminati.zone
- The zone to use for requests.password
- The password for luminatiproxyCountry
- The country code (or null/empty for any) proxies should come fromjava.net.UnknownHostException
- On failure to resolve the luminati address with a DNS lookuppublic void setLastRequestAsBadProxy()
public void refreshCurrentProxies()
@Nullable public java.lang.String getProxyCountry()
@NotNull public java.lang.String getZone()
public void setZone(@NotNull java.lang.String zone)
zone
- The new value for Zonepublic void setNumberOfProxies(int numberOfProxies)
numberOfProxies
- How many proxies should be in the pool at a given time (must be at least 1)public void setRequestsPerProxyIp(int requestsPerProxyIp)
requestsPerProxyIp
- How many requests should be allowed from a given ip (must be at least 1)public void setUseProxies(boolean useProxies)
useProxies
- True if proxies should be used, false otherwisepublic void setProxyCountry(@Nullable java.lang.String proxyCountry)
proxyCountry
- The country code for proxies, or null/empty to allow any country@NotNull public java.util.Map<java.lang.String,java.lang.Object> convertMap()
LogMappable
convertMap
in interface LogMappable