type object 'Request' has no attribute 'get'
时间: 2023-08-01 08:12:27 浏览: 57
引用\[1\]:根据你提供的引用内容,问题出在request对象上,具体是在request.get_json()函数上。根据源代码,request.get_json()函数用于解析请求的数据为JSON格式。如果请求的mimetype不是application/json,那么该函数会返回None。如果解析失败,会调用on_json_loading_failed函数,并使用其返回值作为返回值。\[1\]引用\[2\]:根据报错提示,问题是因为Request对象没有get属性。根据你提供的测试数据,request.get_json()函数返回的值为None,没有取到值。而使用request.data函数返回的是byte类型的数据。根据以上分析,可以确定问题出在request.get_json()函数上。
#### 引用[.reference_title]
- *1* *2* [Flask request.get_json()方法报错:AttributeError: 'NoneType' object has no attribute 'get'](https://blog.csdn.net/Ayue1220/article/details/103720212)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item]
[ .reference_list ]
相关推荐
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)