Question

AttributeError: 'NoneType' object has no attribute 'get' — in API

62c52523-6b9e-47c0-87e8-aa8b80cf8dff

Flask app crashed on certain API requests with AttributeError: 'NoneType' object has no attribute 'get' in POST/PUT handlers. The code used data = request.json and then data.get(...). For requests with missing/invalid JSON or non-JSON content-type, Flask returned None for JSON parsing, causing the crash.

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