时隔五年,Scrapyd 终于原生支持 basic auth
Issue in 2014 scrapy/scrapyd/issues/43 Pull request in 2019 scrapy/scrapyd/pull/326 试用 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