Skip to content

Tag: http

Cant decode HTTP Response to JSON (Python3)

I am running a series of API tests and this one is giving me an error. As far as I can tell response.read() converts the HTTP response into binary and then decode() converts that binary into a string but it’s an empty string. When I copy paste the binary string into Python3 (b'{“error”: {&#8…

Calling an External API That Fails Randomly

I am using Django server to call a Korean government’s weather API to retrieve weather data for around 1800 locations. However, this weather API results in time out most of the time. I tried giving resting periods. For example, for every request, it will sleep for 0.8 seconds and after every 30 requests…

How to parse raw HTTP request in Python 3?

I am looking for a native way to parse an http request in Python 3. This question shows a way to do it in Python 2, but uses now deprecated modules, (and Python 2) and I am looking for a way to do it in Python 3. I would mainly like to just figure out what resource is requested and

Python Start HTTP Server In Code (Create .py To Start HTTP Server)

Currently I and many others are using a Python HTTP server on several platforms (Windows, OS X and potentially Linux). We are using a Python HTTP server to test a JavaScript game. Right now we are launching the Python HTTP server through the command line on each platform (CMD, Terminal, etc.). Although this w…