I'm trying to get a jpeg, gif, etc. from http requests but I'm getting an error. Here is a part of the code:
def printimg(url):
    http = httppoolmgr()
    file = http.request('GET',url).read()
    r_data = binascii.unhexlify(file)
    stream = io.BytesIO(r_data)
    img = Image.open(stream)
    #img = Image.open(file)
    return img
the error code return is :
  File "C:\Python34\lib\site-packages\pillow-2.5.3-py3.4-win32.egg\PIL\Image.py"
, line 2256, in open
OSError: cannot identify image file <_io.BytesIO object at 0x02345ED8>
Has anyone already met this kind of problem?
 
     
    