scrapydweb icon indicating copy to clipboard operation
scrapydweb copied to clipboard

Http 400 when trying to access

Open rpinheiro-home opened this issue 2 years ago • 20 comments

I followed the initial guide step by step and when trying to access the initial URL I get an http code 400 and in the log only a json appears containing: node:1

What am I missing?

It's more a question than an issue Thanks

rpinheiro-home avatar Apr 11 '22 23:04 rpinheiro-home

image

rpinheiro-home avatar Apr 12 '22 13:04 rpinheiro-home

[2022-04-12 10:40:48,667] DEBUG    in IndexView: view_args of http://XXX.XXX.XXX.XXX:5000/
{
    "node": 1
}
[2022-04-12 10:40:48,668] INFO     in werkzeug: XXX.XXX.XXX.XXX- - [12/Apr/2022 10:40:48] "GET / HTTP/1.1" 400 -

rpinheiro-home avatar Apr 12 '22 13:04 rpinheiro-home

I don't know exactly why (because I don`t know flask) but commented this lines and now I can acess.

        # if app.testing:
        # self.logger.debug('view_args of %s\n%s', request.url, self.json_dumps(request.view_args))
        # if request.args:
        #     self.logger.debug('request.args of %s\n%s', request.url, self.json_dumps(request.args))
        # if request.form:
        #     self.logger.debug('request.form from %s\n%s', request.url, self.json_dumps(request.form))
        # if request.json:
        #     self.logger.debug('request.json from %s\n%s', request.url, self.json_dumps(request.json))
        # if request.files:
        #     self.logger.debug('request.files from %s\n\n    %s\n', request.url, request.files)

rpinheiro-home avatar Apr 12 '22 17:04 rpinheiro-home

it's seem that werkzeug 2.1.0 got some break change about request.json you can just specific werkzeug version to 2.0.3 will sovle the case https://github.com/pallets/werkzeug/issues/2339

Pandaaaa906 avatar Apr 13 '22 10:04 Pandaaaa906

thanks @Pandaaaa906 ,I solved the problem through your suggestion,pip install Werkzeug==2.0.3

cced3000 avatar Apr 21 '22 02:04 cced3000

thanks @Pandaaaa906 ,I solved the problem through your suggestion,pip install Werkzeug==2.0.3

Thanks you..

espoirMur avatar Apr 30 '22 10:04 espoirMur

Http 400 when trying to access i got the same problem Screenshot from 2022-05-10 16-21-12

and this what in terminal I get `[2022-05-10 16:23:21,104] INFO in werkzeug: * Running on all addresses (0.0.0.0) WARNING: This is a development server. Do not use it in a production deployment.

  • Running on http://xxx.xxx.x.x:5000
  • Running on http://xxx.xxx.x.x:5000 (Press CTRL+C to quit) [2022-05-10 16:23:24,577] INFO in werkzeug: 127.0.0.1 - - [10/May/2022 16:23:24] "GET / HTTP/1.1" 400 -`

Ngounse avatar May 10 '22 09:05 Ngounse

please help

Ngounse avatar May 10 '22 09:05 Ngounse

Http 400 when trying to access i got the same problem Screenshot from 2022-05-10 16-21-12

and this what in terminal I get `[2022-05-10 16:23:21,104] INFO in werkzeug: * Running on all addresses (0.0.0.0) WARNING: This is a development server. Do not use it in a production deployment.

  • Running on http://xxx.xxx.x.x:5000
  • Running on http://xxx.xxx.x.x:5000 (Press CTRL+C to quit) [2022-05-10 16:23:24,577] INFO in werkzeug: 127.0.0.1 - - [10/May/2022 16:23:24] "GET / HTTP/1.1" 400 -`

Bad Request The browser (or proxy) sent a request that this server could not understand.

我也遇到了同样的问题 我的机器是ubuntu18.04
但是在本地windows 是正常加载的 不知道什么原因

I ran into the same problem with ubuntu18.04 But Windows loads normally locally for unknown reason

casual-silva avatar May 10 '22 11:05 casual-silva

Http 400 when trying to access i got the same problem Screenshot from 2022-05-10 16-21-12 and this what in terminal I get `[2022-05-10 16:23:21,104] INFO in werkzeug: * Running on all addresses (0.0.0.0) WARNING: This is a development server. Do not use it in a production deployment.

  • Running on http://xxx.xxx.x.x:5000
  • Running on http://xxx.xxx.x.x:5000 (Press CTRL+C to quit) [2022-05-10 16:23:24,577] INFO in werkzeug: 127.0.0.1 - - [10/May/2022 16:23:24] "GET / HTTP/1.1" 400 -`

Bad Request The browser (or proxy) sent a request that this server could not understand.

我也遇到了同样的问题 我的机器是ubuntu18.04 但是在本地windows 是正常加载的 不知道什么原因

I ran into the same problem with ubuntu18.04 But Windows loads normally locally for unknown reason Thank you your help

i'm running on zorin os 16 ( ubuntu 20.0.4 base) i been try to fix it but get no where

Ngounse avatar May 11 '22 01:05 Ngounse

I solved the problem to locate the source code and found it was caused by the Werkzeug version problem As he said, @pandaaaa906 can be solved by lowering Werkzeug

Reinstall >> pip install Werkzeug==2.0.2

casual-silva avatar May 11 '22 02:05 casual-silva

I solved the problem to locate the source code and found it was caused by the Werkzeug version problem As he said, @Pandaaaa906 can be solved by lowering Werkzeug

Reinstall >> pip install Werkzeug==2.0.2

it's work now @casual-silva thank you a lot

Ngounse avatar May 11 '22 03:05 Ngounse

I also Solve same problem by your suggestion.Thank You

thanks @Pandaaaa906 ,I solved the problem through your suggestion,pip install Werkzeug==2.0.3

Nirav-Ironlist avatar Jun 24 '22 16:06 Nirav-Ironlist

I pip install Werkzeug==2.0.3,but got following error:

Traceback (most recent call last):
  File "/Users/sunlingfeng/guolu/study-scrapy/bookscraper/.venv/bin/scrapydweb", line 5, in <module>
    from scrapydweb.run import main
  File "/Users/sunlingfeng/guolu/study-scrapy/bookscraper/.venv/lib/python3.8/site-packages/scrapydweb/__init__.py", line 9, in <module>
    from flask import Flask, current_app, render_template, url_for
  File "/Users/sunlingfeng/guolu/study-scrapy/bookscraper/.venv/lib/python3.8/site-packages/flask/__init__.py", line 4, in <module>
    from . import json as json
  File "/Users/sunlingfeng/guolu/study-scrapy/bookscraper/.venv/lib/python3.8/site-packages/flask/json/__init__.py", line 8, in <module>
    from ..globals import current_app
  File "/Users/sunlingfeng/guolu/study-scrapy/bookscraper/.venv/lib/python3.8/site-packages/flask/globals.py", line 56, in <module>
    app_ctx: "AppContext" = LocalProxy(  # type: ignore[assignment]
TypeError: __init__() got an unexpected keyword argument 'unbound_message'

minikiller avatar Sep 01 '22 01:09 minikiller

venv

I saw it complain from flask maybe that the problem here my flask --v Flask==2.1.2

Ngounse avatar Sep 01 '22 01:09 Ngounse

can i also see you pip freeze

Ngounse avatar Sep 01 '22 01:09 Ngounse

I pip install Werkzeug==2.0.3,but got following error:

Traceback (most recent call last):
  File "/Users/sunlingfeng/guolu/study-scrapy/bookscraper/.venv/bin/scrapydweb", line 5, in <module>
    from scrapydweb.run import main
  File "/Users/sunlingfeng/guolu/study-scrapy/bookscraper/.venv/lib/python3.8/site-packages/scrapydweb/__init__.py", line 9, in <module>
    from flask import Flask, current_app, render_template, url_for
  File "/Users/sunlingfeng/guolu/study-scrapy/bookscraper/.venv/lib/python3.8/site-packages/flask/__init__.py", line 4, in <module>
    from . import json as json
  File "/Users/sunlingfeng/guolu/study-scrapy/bookscraper/.venv/lib/python3.8/site-packages/flask/json/__init__.py", line 8, in <module>
    from ..globals import current_app
  File "/Users/sunlingfeng/guolu/study-scrapy/bookscraper/.venv/lib/python3.8/site-packages/flask/globals.py", line 56, in <module>
    app_ctx: "AppContext" = LocalProxy(  # type: ignore[assignment]
TypeError: __init__() got an unexpected keyword argument 'unbound_message'

I have the same problem, did you find out how to fix it?

Resalee avatar Sep 01 '22 09:09 Resalee

@minikiller I tried to use docker images from dockerhub, and it worked, this one => https://hub.docker.com/r/ryanvin/scrapydweb

Resalee avatar Sep 01 '22 09:09 Resalee

I pip install Werkzeug==2.0.3,but got following error:

Traceback (most recent call last):
  File "/Users/sunlingfeng/guolu/study-scrapy/bookscraper/.venv/bin/scrapydweb", line 5, in <module>
    from scrapydweb.run import main
  File "/Users/sunlingfeng/guolu/study-scrapy/bookscraper/.venv/lib/python3.8/site-packages/scrapydweb/__init__.py", line 9, in <module>
    from flask import Flask, current_app, render_template, url_for
  File "/Users/sunlingfeng/guolu/study-scrapy/bookscraper/.venv/lib/python3.8/site-packages/flask/__init__.py", line 4, in <module>
    from . import json as json
  File "/Users/sunlingfeng/guolu/study-scrapy/bookscraper/.venv/lib/python3.8/site-packages/flask/json/__init__.py", line 8, in <module>
    from ..globals import current_app
  File "/Users/sunlingfeng/guolu/study-scrapy/bookscraper/.venv/lib/python3.8/site-packages/flask/globals.py", line 56, in <module>
    app_ctx: "AppContext" = LocalProxy(  # type: ignore[assignment]
TypeError: __init__() got an unexpected keyword argument 'unbound_message'

I have the same problem, did you find out how to fix it?

please see: https://github.com/my8100/scrapydweb/issues/202 you can set the flask version to 2.0.2 and Werkzeug version to 2.0.2 by reinstalling.

afc3liuyuan avatar Sep 05 '22 16:09 afc3liuyuan

Thanks @PandyYang please see: https://github.com/my8100/scrapydweb/issues/202

reinstall the flask version to 2.0.2 and Werkzeug version to 2.0.2 can resolve this problem.

afc3liuyuan avatar Sep 05 '22 16:09 afc3liuyuan