'Decompress HTTP response using Python socket

I'm using socket with python 2.7.12 and whenever I read the body of a HTTP response like the following:

response_body = server_socket.recv(body_len)

I receive compressed data (compressed with gzip). After a lot of not working solutions from Google, I would like to as if there is any way to read the HTTP requests / responses as a plain text using python socket?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source