1 year ago

#348892

test-img

norkey

werkzeug.exceptions.ClientDisconnected: 400 Bad Request: The browser (or proxy) sent a request that this server could not understand

code(python):


    try:
        xxx    
        try:
            post_dic = request.get_json()
            req_ip = request.remote_addr
        except Exception as error:
            logging.error("xxx")

error logging:

Tue, 29 Mar 2022 17:44:12 data_preprocess_server.py[line:223]|[ERROR] [new_data__
processor]: get input data failed, you must use Content-Type: application/json,  
logId=[xxx], Exception=[400 Bad Request: The brr
owser (or proxy) sent a request that this server could not understand.], tracebaa
ck=[Traceback (most recent call last):
  File "xxx.py", line 220, in new_data_preprocess
    post_dic = request.get_json()
  File "/xxx/python3832/lib/python3.8/site-packages/werkzeug/wrappp
ers/request.py", line 583, in get_json
    data = self.get_data(cache=cache)
  File "/xxx/python3832/lib/python3.8/site-packages/werkzeug/wrappp
ers/request.py", line 424, in get_data
    rv = self.stream.read()
  File "/xxx/python3832/lib/python3.8/site-packages/werkzeug/wsgi..
py", line 925, in read
    return self.on_disconnect()
  File "/xxx/python3832/lib/python3.8/site-packages/werkzeug/wsgi..
py", line 893, in on_disconnect
    raise ClientDisconnected()
werkzeug.exceptions.ClientDisconnected: 400 Bad Request: The browser (or proxy)  
sent a request that this server could not understand.

i want to learn about how to fix this question by my role who provide the service, because i can't ask the roles who request my service to try to fix this bug, like increase the connection time or use retry

python-3.x

flask

timeout

client

werkzeug

0 Answers

Your Answer

Accepted video resources