Issue in 2014
Pull request in 2019
试用
1. 安装: pip install -U git+https://github.com/my8100/scrapyd.git@add_basic_auth
2. 更新配置文件 scrapyd.conf,其余配置项详见官方文档
[scrapyd]
username = yourusername
password = yourpassword
3. 启动: scrapyd
In [1]: import requests
In [2]: requests.get('http://127.0.0.1:6800/').status_code
Out[2]: 401
In [3]: requests.get('http://127.0.0.1:6800/', auth=('admin', 'admin')).status_code
Out[3]: 401
In [4]: requests.get('http://127.0.0.1:6800/', auth=('yourusername', 'yourpassword')).status_code
Out[4]: 200
4. 由于 Scrapyd 的 GitHub 最新提交已经重构了 Jobs 页面,如果正在使用 ScrapydWeb 管理 Scrapyd,则需同步更新 ScrapydWeb:
pip install -U git+https://github.com/my8100/scrapydweb.git
GitHub
原文出处:https://www.cnblogs.com/my8100/p/scrapyd-basic-auth.html
来源:oschina
链接:https://my.oschina.net/u/4349408/blog/3264250