This is a link to an example of file that I have to elaborate:
original:http://www.2shared.com/photo/1C5pAlN2/original.html
to elaborate:http://www.2shared.com/photo/ZLnACSjh/wget.html
One is the correct image and the next is the file downloaded from python script.
I have write this code:
try:
f=open(file_path,"r")
msg = email.message_from_file(f)
except email.Errors.MessageParseError:
print "error"
image=msg.get_payload(decode=True)
localFile = open("/var/www/tmp/14c104b2-ea86-413a-9d9e-7da703b78853/map001.tif", 'wb')
localFile.write(image)
The output file differ from the original by two points ..
In the original the top of the file contain:
..--_boundary_g9ct9yt0
MIME-Version: 1.0
Content-type: text/xml
Content-ID: urn:ogc:wcs:1.1:coverages
The modified:
--_boundary_g9ct9yt0
MIME-Version: 1.0
Content-type: text/xml
Content-ID: urn:ogc:wcs:1.1:coverages
So the image is not extracted.
The file that I download contain a part of xml code and a part that contain the image.
How can I extract the image?
Thanks.