code to retrieve web mail?

Cliff Wells cliff at develix.com
Tue Aug 1 01:09:37 EDT 2006


On Tue, 2006-08-01 at 01:47 +0000, John Savage wrote:
> I have a free web mail address and would like to use python to retrieve
> files that have been emailed to me. The basic code would accommodate
> cookies, a login name and password, then download using the full URL I
> can provide. From postings here I thought mechanize held promise, but
> I've found it to contain filenames that are invalid for MSDOS (too many
> characters, and/or too many dots in the name, etc.) so I have little hope
> that the mechanize module can be used.
> 
> I'm running python2.4.2 on plain MSDOS (not windows), so would appreciate
> a pointer to sample code that can do the job. I know that curl has this
> capability, but I'll learn something by tinkering with python code.

PyCurl certainly does have that capability, although the docs were
practically non-existent last I looked (and I've not tried it on DOS).
Still Google will help get you through it, along with the examples
included with the package, and once it's working PyCurl does an
outstanding job.

You might take a look at Beautiful Soup for parsing the HTML once PyCurl
has fetched it for you:

http://www.crummy.com/software/BeautifulSoup/

Also, no matter what method you finally end up with, you'll undoubtedly
need to mangle long filenames into 8.3 names, at least for attachments
and the like.

Regards,
Cliff

-- 




More information about the Python-list mailing list