 <p>From the Flask <code>Request</code> class documentation:</p> <blockquote> <p><strong>json</strong></p> <p>If the mimetype is application/json this will contain the parsed JSON data. Otherwise this will be None.</p> <p>The get_json() method should be used instead.</p> </blockquote> <p>I think your problem appears because request.form doesn't contain <code>hosts</code> key (contains something else), because your mimetype is not json (application/json).</p> <p>For a more precise answer please write what comes in <code>request.form</code>?</p>