您现在的位置是:网站首页>文章详情文章详情

'Connection aborted.', RemoteDisconnecte

inlike2019-11-23 原创文章 浏览(1935) 评论(0) 喜欢(34)

简介requests请求库出现错误:requests.exceptions.ConnectionError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response',)),该错误是headers中与编码相关的字段冲突导致。

如请求头如下:

headers = {'access-control-allow-credentials''true',
                        'access-control-allow-origin''https',
                        'Cache-Control''no-store, no-cache, must-revalidate, proxy-revalidate',
                        'Connection''Keep-Alive',
                        'Content-Type''application/json; charset=UTF-8',
                        'Date''Wed, 09 Oct 2019 00',
                        'Expires''0',
                        'Keep-Alive''timeout=5, max=99',
                        'Pragma''no-cache',
                        'Server''CPWS',
                        'Strict-Transport-Security''max-age=31536000; includeSubDomains',
                        'Surrogate-Control''no-store',
                        #'Transfer-Encoding''chunked',
                        'Vary''Accept-Encoding,Origin,Access-Control-Request-Method,Access-Control-Request-Headers',
                        'X-Content-Type-Options''nosniff',
                        'X-DNS-Prefetch-Control''off',
                        'X-Download-Options''noopen',
                        'X-Frame-Options''SAMEORIGIN',
                        'X-XSS-Protection''1; mode=block'}

其中注释掉的'Transfer-Encoding': 'chunked',与编码相关,部注释掉的话会出现以上错误信息。

image.png


很赞哦! ( 34)
    《Python实战进阶》
    None
    None
    夏至已深

站点信息

  • 建站时间:2019-5-24
  • 网站程序:like in love
  • 主题模板《今夕何夕》
  • 文章统计:104条
  • 文章评论:***条
  • 微信公众号:扫描二维码,关注我们
  • 个人微信公众号