报错场景

social_django 组件对原生 django 的支持较好, 但是因为 在此DRF进行的验证为 JWT 方式 和 django 的验证存在区别,

因此需要进行更改自行支持 JWT 方式的验证信息的加入

更改后再验证第三方登录时发生如下报错

详细报错

[29/Apr/2019 15:12:02] "GET / HTTP/1.1" 200 6992
[29/Apr/2019 15:12:11] "GET /login/weibo/ HTTP/1.1" 302 0
[29/Apr/2019 15:12:13] "GET /complete/weibo/?state=cpNja8cxhyV9GPSKvjVfWnwogNskNjob&code=ba1e4f6fd32f32d0b57094eecd0e7d1b HTTP/1.1" 302 0
Traceback (most recent call last):File "C:\Python36\lib\wsgiref\handlers.py", line 138, in runself.finish_response()File "C:\Python36\lib\wsgiref\handlers.py", line 180, in finish_responseself.write(data)File "C:\Python36\lib\wsgiref\handlers.py", line 274, in writeself.send_headers()File "C:\Python36\lib\wsgiref\handlers.py", line 333, in send_headersself._write(bytes(self.headers))File "C:\Python36\lib\wsgiref\headers.py", line 142, in __bytes__return str(self).encode('iso-8859-1')
UnicodeEncodeError: 'latin-1' codec can't encode characters in position 251-253: ordinal not in range(256)
[29/Apr/2019 15:12:13] "GET /complete/weibo/?state=cpNja8cxhyV9GPSKvjVfWnwogNskNjob&code=ba1e4f6fd32f32d0b57094eecd0e7d1b HTTP/1.1" 500 59
----------------------------------------
Exception happened during processing of request from ('127.0.0.1', 11977)
Traceback (most recent call last):File "C:\Python36\lib\wsgiref\handlers.py", line 138, in runself.finish_response()File "C:\Python36\lib\wsgiref\handlers.py", line 180, in finish_responseself.write(data)File "C:\Python36\lib\wsgiref\handlers.py", line 274, in writeself.send_headers()File "C:\Python36\lib\wsgiref\handlers.py", line 333, in send_headersself._write(bytes(self.headers))File "C:\Python36\lib\wsgiref\headers.py", line 142, in __bytes__return str(self).encode('iso-8859-1')
UnicodeEncodeError: 'latin-1' codec can't encode characters in position 251-253: ordinal not in range(256)

During handling of the above exception, another exception occurred:Traceback (most recent call last):File "C:\Python36\lib\wsgiref\handlers.py", line 141, in runself.handle_error()File "C:\Python36\lib\site-packages\django\core\servers\basehttp.py", line 88, in handle_errorsuper(ServerHandler, self).handle_error()File "C:\Python36\lib\wsgiref\handlers.py", line 368, in handle_errorself.finish_response()File "C:\Python36\lib\wsgiref\handlers.py", line 180, in finish_responseself.write(data)File "C:\Python36\lib\wsgiref\handlers.py", line 274, in writeself.send_headers()File "C:\Python36\lib\wsgiref\handlers.py", line 331, in send_headersif not self.origin_server or self.client_is_modern():File "C:\Python36\lib\wsgiref\handlers.py", line 344, in client_is_modernreturn self.environ['SERVER_PROTOCOL'].upper() != 'HTTP/0.9'
TypeError: 'NoneType' object is not subscriptableDuring handling of the above exception, another exception occurred:Traceback (most recent call last):File "C:\Python36\lib\socketserver.py", line 639, in process_request_threadself.finish_request(request, client_address)File "C:\Python36\lib\socketserver.py", line 361, in finish_requestself.RequestHandlerClass(request, client_address, self)File "C:\Python36\lib\socketserver.py", line 696, in __init__self.handle()File "C:\Python36\lib\site-packages\django\core\servers\basehttp.py", line 155, in handlehandler.run(self.server.get_app())File "C:\Python36\lib\wsgiref\handlers.py", line 144, in runself.close()File "C:\Python36\lib\wsgiref\simple_server.py", line 35, in closeself.status.split(' ',1)[0], self.bytes_sent
AttributeError: 'NoneType' object has no attribute 'split'
----------------------------------------

解决方式

姑且这样子可以解决, 但是不知道这样会不会造成不好的影响

转载于:https://www.cnblogs.com/shijieli/p/10791247.html

AttributeError: 'NoneType' object has no attribute 'split' 报错处理相关推荐

  1. AttributeError: 'NoneType' object has no attribute 'grid'报错解决方案

    1问题描述: 当我们在使用tkinter时经常遇到AttributeError: 'NoneType' object has no attribute 'grid'的报错 2.原因分析: import ...

  2. AttributeError: ‘Request‘ object has no attribute ‘is_xhr‘ 报错

    在用 Flask+VUE 做前后端分离的数据可视化项目时,遇到了这个报错:AttributeError: 'Request' object has no attribute 'is_xhr' 是 We ...

  3. AttributeError: 'Request' object has no attribute 'is_xhr' 报错的解决办法

    在用 Flask+VUE 做前后端分离的数据可视化项目时,遇到了这个报错:AttributeError: 'Request' object has no attribute 'is_xhr' 是 We ...

  4. AttributeError: ‘PosixPath‘ object has no attribute ‘rstrip‘ 报错问题记录

    环境 python3.6.5 django 3.1.5 问题定位及解决 最近准备开发一个在线教育的网站,各个环境都搭好了,并且测试demo 也能跑的好好的,为了以后 调试接口方便,所以我打算把swag ...

  5. 解决AttributeError: 'str' object has no attribute 'decode'报错问题

    顺着报错文件点进去,找到query = query.decode(errors='replace') 将decode修改为encode即可

  6. AttributeError: 'function' object has no attribute 'Document'报错解决

    原因是函数名称和系统中的某个名称相同的,替换另外的名字就行了 报错代码: #读取docx中的文本代码示例 import docx def docx():file=docx.Document(filen ...

  7. 【聚类算法】用Sklearn封装的KMeans | DBSCAN算法详解 |【问题解决】AttributeError: ‘NoneType‘ object has no attribute split

    欲买桂花同载酒,终不似,少年游.

  8. Scrapy爬虫报错AttributeError: ‘NoneType‘ object has no attribute ‘write‘

    前言 一.报错 AttributeError: 'NoneType' object has no attribute 'write' 二.报错原因 1.piplines文件中的方法不能自定义的呢 开始 ...

  9. Pycharm报错:AttributeError: ‘NoneType‘ object has no attribute ‘_gdal‘的解决办法

    Pycharm报错:AttributeError: 'NoneType' object has no attribute '_gdal'的解决办法 解决办法如下: pycharm找到settings ...

最新文章

  1. GOPROXY环境变量中direct的含义与用途
  2. LeetCode Algorithm 7. 整数反转
  3. Flashdevelop 在Project 上增加 ComboBox
  4. 112. 路径总和 golang
  5. oracle自动撤销管理,Oracle 9i中自动撤销管理的优点分析
  6. centos运行python程序_CentOS 7定时执行python脚本
  7. UIBackgroundTaskIdentifier 进入后台后结束任务再挂起APP
  8. [CMake] 头文件路径 动态库路径
  9. n160ii打印机查看ip地址_芯烨ip地址设定软件下载|
  10. 显示低帧率排查思路记录
  11. chrome最新Android版本,谷歌chrome浏览器安卓版下载,谷歌chrome浏览器安卓最新版本下载地址 v70.0.3538.110 - 浏览器家园...
  12. 19年6月英语六级第一套听力单词
  13. c++语言编程软件视频教程下载,C++编程开发全套视频教程下载
  14. 英文网站SEO优化技巧大全
  15. 偏差、方差、标准差、协方差
  16. 64位:浪来滔滔江水永不休
  17. Java---高级流
  18. 从学生到机器视觉工程师,我有话要说!
  19. QT教程,QT从入门到实战教程完整版
  20. unicode汉字内码表(转)

热门文章

  1. SpringBoot指南(五)——拦截器、原生组件
  2. 吴恩达机器学习总结五:单变量线性回归实战
  3. 前端 | 每天一个 LeetCode
  4. git缓冲区查看_git原理学习记录:从基本指令到背后原理,实现一个简单的git
  5. Memcached安装与使用实例
  6. [Ext JS 4] 实战之Load Mask(加载遮罩)的显示与隐藏
  7. 学计算机的普通学生那里就业,学计算机我后悔了 现在好就业吗
  8. docker容器内存和CPU使用限制
  9. vbs调用c++dll_COM编程攻略(八 动态调用与IDispatch接口)
  10. python如何输入多行数据合并_Python如何将多行数据合并成一行|python如何实现excle数据合并...