Skip to content
Advertisement

Python HTTPServer: Reponse not getting sent (Looking to return JSON)

Hey there I am working on a Basic server with Python now I am testing out how I can return JSON data, but then now I am failing to return that JSON data.

This is how I am trying to send back JSON to client:

JavaScript

Below is the entire source code:

JavaScript

Can I please get some help on how I can return back JSON data

Advertisement

Answer

Send headers before the body like this:

JavaScript
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement