Python代理数据库模块ProxyPool库链接https://github.com/Python3WebSpider/ProxyPool
启动方式:
python3 run.py
随机获取代理IP接口:http://localhost:5555/random
然而在运行中可能会出现的问题
报错1:
zincrby(REDIS_KEY,proxy,-1)
redis.exceptions.ResponseError: value is not a valid float
查看文档后发现zincrby()跟新为
zincrby(self, name, amount, value)
解决方案: zincrby(REDIS_KEY,-1,proxy)
报错2:
zadd(REDIS_KEY, score, proxy)
redis 'int' object has no attribute 'items'
文档更新为
zadd(self, name, mapping, nx=False, xx=False, ch=False, incr=False)
Set any number of element-name, score pairs to the key ``name``. Pairs
are specified as a dict of element-names keys to score values.
解决方案
zadd(REDIS_KEY,{proxy:score})
如果本文对你有帮助,欢迎打赏本站