浏览代码

fix docip bug & add support for python 3.11 (#205)

Dawei Feng 1 年之前
父节点
当前提交
97229e6f47
共有 3 个文件被更改,包括 3 次插入3 次删除
  1. 1 1
      proxypool/crawlers/public/docip.py
  2. 1 1
      proxypool/processors/tester.py
  3. 1 1
      requirements.txt

+ 1 - 1
proxypool/crawlers/public/docip.py

@@ -25,7 +25,7 @@ class DocipCrawler(BaseCrawler):
             proxy_list = result['data']
             for proxy_item in proxy_list:
                 host = proxy_item['ip']
-                port = proxy_item['port']
+                port = host.split(':')[-1]
                 yield Proxy(host=host, port=port)
         except json.JSONDecodeError:
             print("json.JSONDecodeError")

+ 1 - 1
proxypool/processors/tester.py

@@ -82,7 +82,7 @@ class Tester(object):
             logger.debug(f'testing proxies use cursor {cursor}, count {TEST_BATCH}')
             cursor, proxies = self.redis.batch(cursor, count=TEST_BATCH)
             if proxies:
-                tasks = [self.test(proxy) for proxy in proxies]
+                tasks = [self.loop.create_task(self.test(proxy)) for proxy in proxies]
                 self.loop.run_until_complete(asyncio.wait(tasks))
             if not cursor:
                 break

+ 1 - 1
requirements.txt

@@ -11,7 +11,7 @@ redis>=3.5.3,<4.0.0
 lxml>=4.6.5,<5.0.0
 fake_headers>=1.0.2,<2.0.0
 maxminddb_geolite2==2018.703
-gevent>=21.8.0,<22.0.0
+gevent>=21.8.0,<24.0.0
 tornado>=6.0,<7.0
 itsdangerous==0.24
 MarkupSafe<2.1.0