V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
my8100
V2EX  ›  Python

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

  •  
  •   my8100 ·
    my8100 · 2019-05-09 13:01:42 +08:00 · 1395 次点击
    这是一个创建于 1815 天前的主题,其中的信息可能已经有所发展或是发生改变。

    Issue in 2014

    scrapy/scrapyd/issues/43 issue #43

    Pull request in 2019

    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
    

    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

    my8100/scrapyd

    目前尚无回复
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2831 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 20ms · UTC 06:25 · PVG 14:25 · LAX 23:25 · JFK 02:25
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.