Wednesday, March 11, 2015

Python: A Picture

Information contained in bits grouped in bytes is packaged up and shared on the internet between clients and servers. A computer can receive, send and process bits of information.

Challenge: Serve up a site and load an image that is locally stored.
Problem: Could not serve image even when the data was correctly stored
Solution: Use the necessary headers in the response variable

The first step was to get the raw format of my image, over a thousand obscure and oddly spaced out characters. I modified a small client server in python, updating the path and host, to point to the minuscule image to access the raw data. Even when all the code was correctly saved to the local folder, I could not serve the image. After some failed 'fixes', such as modifying the file type of the image, the page served correctly when I added the correct headers to the response data.

No comments:

Post a Comment