Simplify proxy connector code
This commit is contained in:
@@ -36,7 +36,8 @@ class Proxy:
|
||||
website = DEFAULT_CHECK_WEBSITE
|
||||
async with sem:
|
||||
start = perf_counter()
|
||||
async with self.get_connector(proto) as connector, ClientSession(
|
||||
connector = ProxyConnector(proxy_type=proto, host=self.host, port=self.port)
|
||||
async with ClientSession(
|
||||
connector=connector,
|
||||
cookie_jar=cookie_jar,
|
||||
timeout=timeout,
|
||||
@@ -52,9 +53,6 @@ class Proxy:
|
||||
data["country"], data["regionName"], data["city"]
|
||||
)
|
||||
|
||||
def get_connector(self, proto: ProxyType) -> ProxyConnector:
|
||||
return ProxyConnector(proxy_type=proto, host=self.host, port=self.port)
|
||||
|
||||
def as_str(self, *, include_geolocation: bool) -> str:
|
||||
if include_geolocation:
|
||||
return f"{self.host}:{self.port}{self.geolocation}"
|
||||
|
||||
Reference in New Issue
Block a user