Gzipping filestream for upload in multiform
<p>I'm working on uploading an mp3 file to a webhost (which i have no control over) and after a related question on StackOverflow, i noticed that the host does support Gzip encoded uploads.</p>

<p>In python, how would i be able to encode my stream (which i get from open(filename)) and send that to the server?</p>

<pre><code>def upSong(fileName):
    datagen, headers = multipart_encode({"mumuregularfile_0": open(fileName, "rb")})

    uploadID = math.floor(random.random()*1000000)
    request = urllib2.Request("http://upload0.mumuplayer.com:443/?browserID=" + browserID + "&amp;browserUploadID=" + str(uploadID), datagen, headers)

    urllib2.urlopen(request).read()
</code></pre>

<p>This is the code that does the uploading, being fairly new to python i have no idea how i would tackle a problem like this, but google have provided no answer.</p>
