MIMETOOLS QUESTION

Fredrik Lundh effbot at telia.com
Fri Mar 3 14:39:51 EST 2000


Gregoire Welraeds <greg at perceval.be> wrote:
> According to the Library reference doc, on page 244 (section 12.7) the
> package tool define a Message(fp[,seekable]). Wel, very cool... but what
> are fp and seekable after all ?

the copy I have points out that mimetools.Message is a sub-
class of rfc822.Message.  the arguments are well explained
in that chapter...

> All I want is to parse a MIME header from a string read on a socket...

the Message takes any file object which properly implements
"readline".  you can use StringIO to access your string as if
it were a file -- or in this case, you can use "makefile" on the
socket to wrap the socket itself in a file object.

> I found that, except for the tutorial, there is a lack of example in the
> python documentation. Python is not a strong typed language so it's pretty
> difficult to find the meaning of some arguments used in the API.
>
> Maybe Guido could take some example of the Faqts site to put them in the
> doc... Guido ?

better make that "Fred"

fwiw, there's plenty of cookbooks out there.  here are a few:

+ Python Annotated Archives (by Martin Brown):

    http://www.python.org/psa/bookstore

  50+ sample scripts from various sources; extensive
  annotations by the author.  massive piece of work.

+ Programming with Python (by Tim Altom):

    http://www.python.org/psa/bookstore

  have only browsed it, but it appears to be a budget
  version of the annotated archives.  early reviewers
  seem to think it's no good, so you may wish to check
  it out in a bookstore before buying it.

+ The Python Grimoire (by Andrew Kuchling):

    http://starship.python.net/crew/amk/grimoire/

  work in progress; sample scripts from various (mostly
  unattributed?) sources; sorted by task.  (like martin's
  book, this seems to contain some eff-bot code, so it
  cannot be all bad ;-)

+ (the eff-bot guide to) The Standard Python Library,
  eMatter edition (by Fredrik Lundh):

    http://www.pythonware.com/people/fredrik/librarybook.htm

  320 sample scripts, sorted by standard library module.
  more code and less annotations than the others (after
  all, python code is supposed to be easy to read ;-).

</F>





More information about the Python-list mailing list