SpiderClub / haipproxy

:sparkling_heart: High available distributed ip proxy pool, powerd by Scrapy and Redis
https://spiderclub.github.io/haipproxy/
MIT License
5.43k stars 914 forks source link

api 接口 bug #73

Open whg517 opened 6 years ago

whg517 commented 6 years ago

1. api 获取代理全部为 https 的代理

https://github.com/SpiderClub/haipproxy/blob/9e11cdeb71a209f0ec3db05c67351de42acbd7b8/haipproxy/api/core.py#L22

因为 ProxyFetcher('task') 传入为字符串'task'

https://github.com/SpiderClub/haipproxy/blob/9e11cdeb71a209f0ec3db05c67351de42acbd7b8/haipproxy/client/py_cli.py#L112 在判断不在 sorce_map 中会赋值为 https https://github.com/SpiderClub/haipproxy/blob/9e11cdeb71a209f0ec3db05c67351de42acbd7b8/haipproxy/client/py_cli.py#L114

所以这里逻辑有点问题。正确获取对应 usage 的 proxy 应该是

- usage_registry = {task['name']: ProxyFetcher('task') for task in VALIDATOR_TASKS}
+ usage_registry = {task['name']: ProxyFetcher(task['name']) for task in VALIDATOR_TASKS}

2. delete 接口参数设置错误

https://github.com/SpiderClub/haipproxy/blob/9e11cdeb71a209f0ec3db05c67351de42acbd7b8/haipproxy/api/core.py#L58

使用这个接口的方式应该是

http://127.0.0.1:5000/proxy/delete/zhihu/http://1.63.153.153:80

但是很明显这个 URL 是有问题的 对于 proxy 参数,如果要正常传入应该在 request body 中发送。

建议优化接口参数接收方式和数据接收方式。

ResolveWang commented 6 years ago

感谢指出错误。 api这个功能目前还在开发中,master上的东西并不是稳定的。目前精力不是很够,所以一直没更新,api这里最大的问题还是在于多个用户的IP使用隔离机制,这一点也还在探索之中