Skip to content

Latest commit

 

History

History
45 lines (30 loc) · 1.67 KB

README_CN.md

File metadata and controls

45 lines (30 loc) · 1.67 KB

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

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

Issue in 2014

scrapy/scrapyd#43 issue #43

Pull request in 2019

scrapy/scrapyd#326 pull request #326

试用

  1. 安装:pip install -U git+https://github.com/my8100/scrapyd.git@add_basic_auth

PR 已被合并: pip install -U git+https://github.com/scrapy/scrapyd.git

  1. 更新配置文件 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