MCPcopy Index your code
hub / github.com/jhao104/proxy_pool / get

Method get

db/ssdbClient.py:50–62  ·  view source on GitHub ↗

从hash中随机返回一个代理 :return:

(self, https)

Source from the content-addressed store, hash-verified

48 **kwargs))
49
50 def get(self, https):
51 """
52 从hash中随机返回一个代理
53 :return:
54 """
55 if https:
56 items_dict = self.__conn.hgetall(self.name)
57 proxies = list(filter(lambda x: json.loads(x).get("https"), items_dict.values()))
58 return choice(proxies) if proxies else None
59 else:
60 proxies = self.__conn.hkeys(self.name)
61 proxy = choice(proxies) if proxies else None
62 return self.__conn.hget(self.name, proxy) if proxy else None
63
64 def put(self, proxy_obj):
65 """

Callers 3

popMethod · 0.95
getAllMethod · 0.45
getCountMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected