Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
1 contributor

Users who have contributed to this file

43 lines (29 sloc) 1.59 KB

🔤 English | 🀄️ 简体中文 | 🔙 my8100/files

时隔五年,Scrapyd 终于原生支持 basic auth

Issue in 2014

https://github.com/scrapy/scrapyd/issues/43 issue #43

Pull request in 2019

https://github.com/scrapy/scrapyd/pull/326 pull request #326

试用

  1. 安装:pip install -U git+https://github.com/my8100/scrapyd.git@add_basic_auth
  2. 更新配置文件 scrapyd.conf,其余配置项详见官方文档
[scrapyd]
username = yourusername
password = yourpassword
  1. 启动: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
  1. 由于 Scrapyd 的 GitHub 最新提交已经重构了 Jobs 页面,如果正在使用 ScrapydWeb 管理 Scrapyd,则需同步更新 ScrapydWeb:pip install -U git+https://github.com/my8100/scrapydweb.git

返回顶部

🔙 my8100/files

You can’t perform that action at this time.