推荐学习书目
› 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
Northxw
V2EX  ›  Python

Scrapyd 本地部署出现 Bug: twisted.web.error.UnsupportedMethod: Expected one of [b'HEAD', b'object', b'POST']

  •  
  •   Northxw · Apr 6, 2019 · 3655 views
    This topic created in 2740 days ago, the information mentioned may be changed or developed.

    基本上都是正常操作:启动 Scrapyd 服务,修改.cfg 文件,curl 操作 API,然后就出现了如下的 Bug(我在命令行粘贴下来的):

    2019-04-06T16:31:57+0800 [_GenericHTTPChannelProtocol,35,127.0.0.1] Unhandled Error
            Traceback (most recent call last):
              File "c:\users\northxw\appdata\local\programs\python\python36\lib\site-packages\twisted\web\http.py", line 2190, in allContentReceived
                req.requestReceived(command, path, version)
              File "c:\users\northxw\appdata\local\programs\python\python36\lib\site-packages\twisted\web\http.py", line 917, in requestReceived
                self.process()
              File "c:\users\northxw\appdata\local\programs\python\python36\lib\site-packages\twisted\web\server.py", line 199, in process
                self.render(resrc)
              File "c:\users\northxw\appdata\local\programs\python\python36\lib\site-packages\twisted\web\server.py", line 259, in render
                body = resrc.render(self)
            --- <exception caught here> ---
              File "c:\users\northxw\appdata\local\programs\python\python36\lib\site-packages\scrapyd\webservice.py", line 21, in render
                return JsonResource.render(self, txrequest).encode('utf-8')
              File "c:\users\northxw\appdata\local\programs\python\python36\lib\site-packages\scrapyd\utils.py", line 20, in render
                r = resource.Resource.render(self, txrequest)
              File "c:\users\northxw\appdata\local\programs\python\python36\lib\site-packages\twisted\web\resource.py", line 249, in render
                raise UnsupportedMethod(allowedMethods)
            twisted.web.error.UnsupportedMethod: Expected one of [b'HEAD', b'object', b'POST']
    

      看错误提示,我进入相关文件查看后,找不出异样(emmm......承认自己处理问题的能力), 不知道大家有没有遇到过相同的问题。

    9 replies  •  2019-04-07 01:14:56 +08:00
    midasplus
        1
    midasplus  
       Apr 6, 2019
    贴代码呀
    Northxw
        2
    Northxw  
    OP
       Apr 6, 2019
    @111qqz 就命令行执行了 Scrapyd 的 API 啊,比如:curl http://lcoalhost:6800/schedule.json?project=myproject。就这样就报错了。错误就是上述那样啊。
    midasplus
        3
    midasplus  
       Apr 6, 2019 via Android
    @Northxw 当我没说
    Northxw
        4
    Northxw  
    OP
       Apr 6, 2019
    @111qqz。。。
    Trim21
        5
    Trim21  
       Apr 6, 2019 via Android
    为什么 scrapyd 想要的 http 方法里有一个 object …
    binux
        6
    binux  
       Apr 6, 2019 via Android
    @Trim21 那不管想要什么,都不想要 GET 啊
    Northxw
        7
    Northxw  
    OP
       Apr 6, 2019
    @binux woc...bniux 大神,头像很粉嫩哦,哈哈
    Trim21
        8
    Trim21  
       Apr 6, 2019 via Android
    Northxw
        9
    Northxw  
    OP
       Apr 7, 2019
    @Trim21 这个我注意到了,我用 Postman 测得时候将请求改为 POST 确实状态 OK。但是之前运行的时候没有出过 bug, 不清楚了.......
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   917 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 29ms · UTC 18:30 · PVG 02:30 · LAX 11:30 · JFK 14:30
    ♥ Do have faith in what you're doing.