Python: Post Request with image files
===

I have a server and I am trying to build a post request to get the data back. I think one way to achieve this is to add the parameters in the header and make the request. But I am getting few errors that I don't understand well enough to go forward. 

Html Form

    <html>
    <head>
    <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
      </head>
      <body>
         <form method="POST" action="http://some.server.com:61235/imgdigest" enctype="multipart/form-data">
            quality:<input type="text" name="quality" value="2"><br>
            category:<input type="text" name="category" value="1"><br>
            debug:<input type="text" name="debug" value="1"><br>
            image:<input type="file" name="image"><br>
            <input type="submit" value="Submit">
         </form>
      </body>
    </html>

Python code:
import urllib, urllib2

    if __name__ == '__main__':
        page = 'http://some.server.com:61235/imgdigest.html'
        raw_params = {'quality':'2','category':'1','debug':'0', 'image': '~/image.jpg'}
        params = urllib.urlencode(raw_params)
        request = urllib2.Request(page, params)
        page = urllib2.urlopen(request)
        info = page.info() 