MCPcopy Create free account
hub / github.com/Boris-code/feapder / get_proxy

Method get_proxy

feapder/network/proxy_pool/proxy_pool.py:43–59  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

41 return proxies.split("\r\n")
42
43 def get_proxy(self):
44 try:
45 if self.proxy_queue.empty():
46 proxies = self.pull_proxies()
47 for proxy in proxies:
48 self.proxy_queue.put_nowait(proxy)
49 metrics.emit_counter("total", 1, classify="proxy")
50
51 proxy = self.proxy_queue.get_nowait()
52 self.proxy_queue.put_nowait(proxy)
53
54 metrics.emit_counter("used_times", 1, classify="proxy")
55
56 return self.format_proxy(proxy)
57 except Exception as e:
58 tools.send_msg("获取代理失败", level="error")
59 raise Exception("获取代理失败", e)
60
61 def del_proxy(self, proxy):
62 """

Callers

nothing calls this directly

Calls 5

pull_proxiesMethod · 0.95
format_proxyMethod · 0.95
emptyMethod · 0.80
emit_counterMethod · 0.80
send_msgMethod · 0.80

Tested by

no test coverage detected