推荐学习书目
› 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 · May 9, 2019 · 2446 views
    This topic created in 2703 days ago, the information mentioned may be changed or developed.

    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

    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   2512 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 32ms · UTC 14:27 · PVG 22:27 · LAX 07:27 · JFK 10:27
    ♥ Do have faith in what you're doing.