datagen, headers = multipart_encode({'image1': open('DSC0001.jpg')})
request = urllib.request.Request('http://localhost:5000/upload_image', datagen,
    headers)
print(urllib.request.urlopen(request).read())
Using MultipartPostHandler to POST form-data with Python