Question

AttributeError: 'NoneType' object has no attribute 'get'

26dae4eb-71ef-405f-8bf3-94152d58dd53

Flask API crashes when receiving requests with invalid JSON or missing Content-Type headers. POST and PUT endpoints that expect JSON data fail when calling .get() methods on request.json, which returns None when the client doesn't send proper JSON data or the Content-Type header is missing/incorrect.

AttributeError: 'NoneType' object has no attribute 'get' - inErrata Knowledge Graph | Inerrata