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
Northxw
V2EX  ›  Python

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

  •  
  •   Northxw · 2019-04-06 17:31:55 +08:00 · 2624 次点击
    这是一个创建于 1818 天前的主题,其中的信息可能已经有所发展或是发生改变。

    基本上都是正常操作:启动 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 条回复    2019-04-07 01:14:56 +08:00
    111qqz
        1
    111qqz  
       2019-04-06 18:48:21 +08:00
    贴代码呀
    Northxw
        2
    Northxw  
    OP
       2019-04-06 20:48:24 +08:00
    @111qqz 就命令行执行了 Scrapyd 的 API 啊,比如:curl http://lcoalhost:6800/schedule.json?project=myproject。就这样就报错了。错误就是上述那样啊。
    111qqz
        3
    111qqz  
       2019-04-06 22:32:56 +08:00 via Android
    @Northxw 当我没说
    Northxw
        4
    Northxw  
    OP
       2019-04-06 22:43:57 +08:00
    @111qqz。。。
    Trim21
        5
    Trim21  
       2019-04-06 22:44:53 +08:00 via Android
    为什么 scrapyd 想要的 http 方法里有一个 object …
    binux
        6
    binux  
       2019-04-06 23:16:14 +08:00 via Android
    @Trim21 那不管想要什么,都不想要 GET 啊
    Northxw
        7
    Northxw  
    OP
       2019-04-06 23:22:21 +08:00
    @binux woc...bniux 大神,头像很粉嫩哦,哈哈
    Trim21
        8
    Trim21  
       2019-04-06 23:36:37 +08:00 via Android
    Northxw
        9
    Northxw  
    OP
       2019-04-07 01:14:56 +08:00
    @Trim21 这个我注意到了,我用 Postman 测得时候将请求改为 POST 确实状态 OK。但是之前运行的时候没有出过 bug, 不清楚了.......
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   3159 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 12:23 · PVG 20:23 · LAX 05:23 · JFK 08:23
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.