urllib problem (maybe bugs?)

Tim Roberts timr at probo.com
Fri Apr 1 03:00:58 EST 2005


Timothy Wu <2huggie at gmail.com> wrote:
>
>I'm trying to fill the form on page
>http://www.cbs.dtu.dk/services/TMHMM/ using urllib.
>
>There are two peculiarities. First of all, I am filling in incorrect
>key/value pairs in the parameters on purpose because that's the only
>way I can get it to work.. For "version" I am suppose to leave it
>unchecked, having value of empty string. And for name "outform" I am
>suppose to assign it a value of "-short". Instead, I left out
>"outform" all together and fill in "-short" for version. I discovered
>the method my accident.
>
>After I've done that it works fine for small SEQ values. Then, when I
>try to send large amount of data (1.4MB), it fails miserably with
>AttributeError exception.
>
>I highly suspect the two problems I have are the result of some bugs
>in the urllib module. Any suggestions?

The <form> on that page wants multipart/form-data encoding, where each
parameter is embedded in a separate MIME section.  That is common with very
large data, and is _required_ when the form includes a file upload.  urllib
doesn't do that.  It always sends plain old
application/x-www-form-urlencoded data.

I think you're going to have to roll your own sender.
-- 
- Tim Roberts, timr at probo.com
  Providenza & Boekelheide, Inc.



More information about the Python-list mailing list