Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
b48327a2
Kaydet (Commit)
b48327a2
authored
Nis 13, 2009
tarafından
Georg Brandl
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
#5745: more linking for identifiers in email docs.
üst
710fbc32
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
65 additions
and
60 deletions
+65
-60
email.charset.rst
Doc/library/email.charset.rst
+2
-2
email.encoders.rst
Doc/library/email.encoders.rst
+9
-9
email.errors.rst
Doc/library/email.errors.rst
+7
-6
email.generator.rst
Doc/library/email.generator.rst
+4
-4
email.header.rst
Doc/library/email.header.rst
+12
-11
email.message.rst
Doc/library/email.message.rst
+16
-14
email.mime.rst
Doc/library/email.mime.rst
+0
-0
email.parser.rst
Doc/library/email.parser.rst
+15
-14
No files found.
Doc/library/email.charset.rst
Dosyayı görüntüle @
b48327a2
...
@@ -163,8 +163,8 @@ Import this class from the :mod:`email.charset` module.
...
@@ -163,8 +163,8 @@ Import this class from the :mod:`email.charset` module.
charset to the output charset automatically. This is not useful for
charset to the output charset automatically. This is not useful for
multibyte character sets, which have line length issues (multibyte
multibyte character sets, which have line length issues (multibyte
characters must be split on a character, not a byte boundary); use the
characters must be split on a character, not a byte boundary); use the
higher-level :class:`
Header` class to deal with these issues (see
higher-level :class:`
~email.header.Header` class to deal with these issues
:mod:`email.header`). *convert* defaults to ``False``.
(see
:mod:`email.header`). *convert* defaults to ``False``.
The type of encoding (base64 or quoted-printable) will be based on the
The type of encoding (base64 or quoted-printable) will be based on the
*header_encoding* attribute.
*header_encoding* attribute.
...
...
Doc/library/email.encoders.rst
Dosyayı görüntüle @
b48327a2
...
@@ -5,18 +5,18 @@
...
@@ -5,18 +5,18 @@
:synopsis: Encoders for email message payloads.
:synopsis: Encoders for email message payloads.
When creating :class:`
Message` objects from scratch, you often need to encode
When creating :class:`
~email.message.Message` objects from scratch, you often
the payloads for transport through compliant mail servers. This is especially
need to encode the payloads for transport through compliant mail servers. This
true for :mimetype:`image/\*` and :mimetype:`text/\*` type messages containing
is especially true for :mimetype:`image/\*` and :mimetype:`text/\*` type messages
binary data.
containing
binary data.
The :mod:`email` package provides some convenient encodings in its
The :mod:`email` package provides some convenient encodings in its
:mod:`encoders` module. These encoders are actually used by the
:mod:`encoders` module. These encoders are actually used by the
:class:`
MIMEAudio` and :class:`MIMEImage` class constructors to provide default
:class:`
~email.mime.audio.MIMEAudio` and :class:`~email.mime.image.MIMEImage`
encodings. All encoder functions take exactly one argument, the message object
class constructors to provide default encodings. All encoder functions take
to encode. They usually extract the payload, encode it, and reset the payload
exactly one argument, the message object to encode. They usually extract the
to this newly encoded value. They should also set the
payload, encode it, and reset the payload to this newly encoded value. They
:mailheader:`Content-Transfer-Encoding` header as appropriate.
should also set the
:mailheader:`Content-Transfer-Encoding` header as appropriate.
Here are the encoding functions provided:
Here are the encoding functions provided:
...
...
Doc/library/email.errors.rst
Dosyayı görüntüle @
b48327a2
...
@@ -17,8 +17,8 @@ The following exception classes are defined in the :mod:`email.errors` module:
...
@@ -17,8 +17,8 @@ The following exception classes are defined in the :mod:`email.errors` module:
.. exception:: MessageParseError()
.. exception:: MessageParseError()
This is the base class for exceptions thrown by the :class:`
Parser` class. It
This is the base class for exceptions thrown by the :class:`
~email.parser.Parser`
is derived from :exc:`MessageError`.
class. It
is derived from :exc:`MessageError`.
.. exception:: HeaderParseError()
.. exception:: HeaderParseError()
...
@@ -55,11 +55,12 @@ The following exception classes are defined in the :mod:`email.errors` module:
...
@@ -55,11 +55,12 @@ The following exception classes are defined in the :mod:`email.errors` module:
Since :meth:`Message.add_payload` is deprecated, this exception is rarely raised
Since :meth:`Message.add_payload` is deprecated, this exception is rarely raised
in practice. However the exception may also be raised if the :meth:`attach`
in practice. However the exception may also be raised if the :meth:`attach`
method is called on an instance of a class derived from
method is called on an instance of a class derived from
:class:`MIMENonMultipart` (e.g. :class:`MIMEImage`).
:class:`~email.mime.nonmultipart.MIMENonMultipart` (e.g.
:class:`~email.mime.image.MIMEImage`).
Here's the list of the defects that the :class:`
FeedParser` can find while
Here's the list of the defects that the :class:`
~email.mime.parser.FeedParser`
parsing messages. Note that the defects are added to the message where th
e
can find while parsing messages. Note that the defects are added to the messag
e
problem was found, so for example, if a message nested inside a
where the
problem was found, so for example, if a message nested inside a
:mimetype:`multipart/alternative` had a malformed header, that nested message
:mimetype:`multipart/alternative` had a malformed header, that nested message
object would have a defect, but the containing messages would not.
object would have a defect, but the containing messages would not.
...
...
Doc/library/email.generator.rst
Dosyayı görüntüle @
b48327a2
...
@@ -16,8 +16,8 @@ functionality of the bundled generator; you could write one from scratch
...
@@ -16,8 +16,8 @@ functionality of the bundled generator; you could write one from scratch
yourself. However the bundled generator knows how to generate most email in a
yourself. However the bundled generator knows how to generate most email in a
standards-compliant way, should handle MIME and non-MIME email messages just
standards-compliant way, should handle MIME and non-MIME email messages just
fine, and is designed so that the transformation from flat text, to a message
fine, and is designed so that the transformation from flat text, to a message
structure via the :class:`
Parser` class, and back to flat text, is idempotent
structure via the :class:`
~email.parser.Parser` class, and back to flat text,
(the input is identical to the output).
is idempotent
(the input is identical to the output).
Here are the public methods of the :class:`Generator` class, imported from the
Here are the public methods of the :class:`Generator` class, imported from the
:mod:`email.generator` module:
:mod:`email.generator` module:
...
@@ -41,8 +41,8 @@ Here are the public methods of the :class:`Generator` class, imported from the
...
@@ -41,8 +41,8 @@ Here are the public methods of the :class:`Generator` class, imported from the
Optional *maxheaderlen* specifies the longest length for a non-continued header.
Optional *maxheaderlen* specifies the longest length for a non-continued header.
When a header line is longer than *maxheaderlen* (in characters, with tabs
When a header line is longer than *maxheaderlen* (in characters, with tabs
expanded to 8 spaces), the header will be split as defined in the
expanded to 8 spaces), the header will be split as defined in the
:
mod:`email.header.Header` class. Set to zero to disable header wrapping. The
:
class:`~email.header.Header` class. Set to zero to disable header wrapping.
default is 78, as recommended (but not required) by :rfc:`2822`.
The
default is 78, as recommended (but not required) by :rfc:`2822`.
The other public :class:`Generator` methods are:
The other public :class:`Generator` methods are:
...
...
Doc/library/email.header.rst
Dosyayı görüntüle @
b48327a2
...
@@ -21,10 +21,10 @@ in its :mod:`email.header` and :mod:`email.charset` modules.
...
@@ -21,10 +21,10 @@ in its :mod:`email.header` and :mod:`email.charset` modules.
If you want to include non-ASCII characters in your email headers, say in the
If you want to include non-ASCII characters in your email headers, say in the
:mailheader:`Subject` or :mailheader:`To` fields, you should use the
:mailheader:`Subject` or :mailheader:`To` fields, you should use the
:class:`Header` class and assign the field in the :class:`
Message` object to an
:class:`Header` class and assign the field in the :class:`
~email.message.Message`
instance of :class:`Header` instead of using a string for the header value.
object to an instance of :class:`Header` instead of using a string for the header
Import the :class:`Header` class from the :mod:`email.header` module. For
value. Import the :class:`Header` class from the :mod:`email.header` module.
example::
For
example::
>>> from email.message import Message
>>> from email.message import Message
>>> from email.header import Header
>>> from email.header import Header
...
@@ -39,9 +39,9 @@ example::
...
@@ -39,9 +39,9 @@ example::
Notice here how we wanted the :mailheader:`Subject` field to contain a non-ASCII
Notice here how we wanted the :mailheader:`Subject` field to contain a non-ASCII
character? We did this by creating a :class:`Header` instance and passing in
character? We did this by creating a :class:`Header` instance and passing in
the character set that the byte string was encoded in. When the subsequent
the character set that the byte string was encoded in. When the subsequent
:class:`
Message` instance was flattened, the :mailheader:`Subject` field was
:class:`
~email.message.Message` instance was flattened, the :mailheader:`Subject`
properly :rfc:`2047` encoded. MIME-aware mail readers would show this header
field was properly :rfc:`2047` encoded. MIME-aware mail readers would show this
using the embedded ISO-8859-1 character.
header
using the embedded ISO-8859-1 character.
.. versionadded:: 2.2.2
.. versionadded:: 2.2.2
...
@@ -84,10 +84,11 @@ Here is the :class:`Header` class description:
...
@@ -84,10 +84,11 @@ Here is the :class:`Header` class description:
Append the string *s* to the MIME header.
Append the string *s* to the MIME header.
Optional *charset*, if given, should be a :class:`Charset` instance (see
Optional *charset*, if given, should be a :class:`~email.charset.Charset`
:mod:`email.charset`) or the name of a character set, which will be
instance (see :mod:`email.charset`) or the name of a character set, which
converted to a :class:`Charset` instance. A value of ``None`` (the
will be converted to a :class:`~email.charset.Charset` instance. A value
default) means that the *charset* given in the constructor is used.
of ``None`` (the default) means that the *charset* given in the constructor
is used.
*s* may be a byte string or a Unicode string. If it is a byte string
*s* may be a byte string or a Unicode string. If it is a byte string
(i.e. ``isinstance(s, str)`` is true), then *charset* is the encoding of
(i.e. ``isinstance(s, str)`` is true), then *charset* is the encoding of
...
...
Doc/library/email.message.rst
Dosyayı görüntüle @
b48327a2
...
@@ -45,8 +45,8 @@ Here are the methods of the :class:`Message` class:
...
@@ -45,8 +45,8 @@ Here are the methods of the :class:`Message` class:
Note that this method is provided as a convenience and may not always
Note that this method is provided as a convenience and may not always
format the message the way you want. For example, by default it mangles
format the message the way you want. For example, by default it mangles
lines that begin with ``From``. For more flexibility, instantiate a
lines that begin with ``From``. For more flexibility, instantiate a
:class:`
Generator` instance and use its :meth:`flatten` method directly.
:class:`
~email.generator.Generator` instance and use its :meth:`flatten`
For example::
method directly.
For example::
from cStringIO import StringIO
from cStringIO import StringIO
from email.generator import Generator
from email.generator import Generator
...
@@ -126,11 +126,12 @@ Here are the methods of the :class:`Message` class:
...
@@ -126,11 +126,12 @@ Here are the methods of the :class:`Message` class:
.. method:: set_charset(charset)
.. method:: set_charset(charset)
Set the character set of the payload to *charset*, which can either be a
Set the character set of the payload to *charset*, which can either be a
:class:`Charset` instance (see :mod:`email.charset`), a string naming a
:class:`~email.charset.Charset` instance (see :mod:`email.charset`), a
character set, or ``None``. If it is a string, it will be converted to a
string naming a character set, or ``None``. If it is a string, it will
:class:`Charset` instance. If *charset* is ``None``, the ``charset``
be converted to a :class:`~email.charset.Charset` instance. If *charset*
parameter will be removed from the :mailheader:`Content-Type`
is ``None``, the ``charset`` parameter will be removed from the
header. Anything else will generate a :exc:`TypeError`.
:mailheader:`Content-Type` header. Anything else will generate a
:exc:`TypeError`.
The message will be assumed to be of type :mimetype:`text/\*` encoded with
The message will be assumed to be of type :mimetype:`text/\*` encoded with
*charset.input_charset*. It will be converted to *charset.output_charset*
*charset.input_charset*. It will be converted to *charset.output_charset*
...
@@ -144,8 +145,8 @@ Here are the methods of the :class:`Message` class:
...
@@ -144,8 +145,8 @@ Here are the methods of the :class:`Message` class:
.. method:: get_charset()
.. method:: get_charset()
Return the :class:`
Charset` instance associated with the message's
Return the :class:`
~email.charset.Charset` instance associated with the
payload.
message's
payload.
.. versionadded:: 2.2.2
.. versionadded:: 2.2.2
...
@@ -478,7 +479,7 @@ Here are the methods of the :class:`Message` class:
...
@@ -478,7 +479,7 @@ Here are the methods of the :class:`Message` class:
that header has no ``charset`` parameter, *failobj* is returned.
that header has no ``charset`` parameter, *failobj* is returned.
Note that this method differs from :meth:`get_charset` which returns the
Note that this method differs from :meth:`get_charset` which returns the
:class:`Charset` instance for the default encoding of the message body.
:class:`
~email.charset.
Charset` instance for the default encoding of the message body.
.. versionadded:: 2.2.2
.. versionadded:: 2.2.2
...
@@ -534,10 +535,11 @@ Here are the methods of the :class:`Message` class:
...
@@ -534,10 +535,11 @@ Here are the methods of the :class:`Message` class:
text can become visible.
text can become visible.
The *preamble* attribute contains this leading extra-armor text for MIME
The *preamble* attribute contains this leading extra-armor text for MIME
documents. When the :class:`Parser` discovers some text after the headers
documents. When the :class:`~email.parser.Parser` discovers some text
but before the first boundary string, it assigns this text to the
after the headers but before the first boundary string, it assigns this
message's *preamble* attribute. When the :class:`Generator` is writing
text to the message's *preamble* attribute. When the
out the plain text representation of a MIME message, and it finds the
:class:`~email.generator.Generator` is writing out the plain text
representation of a MIME message, and it finds the
message has a *preamble* attribute, it will write this text in the area
message has a *preamble* attribute, it will write this text in the area
between the headers and the first boundary. See :mod:`email.parser` and
between the headers and the first boundary. See :mod:`email.parser` and
:mod:`email.generator` for details.
:mod:`email.generator` for details.
...
...
Doc/library/email.mime.rst
Dosyayı görüntüle @
b48327a2
This diff is collapsed.
Click to expand it.
Doc/library/email.parser.rst
Dosyayı görüntüle @
b48327a2
...
@@ -6,18 +6,18 @@
...
@@ -6,18 +6,18 @@
Message object structures can be created in one of two ways: they can be created
Message object structures can be created in one of two ways: they can be created
from whole cloth by instantiating :class:`
Message` objects and stringing them
from whole cloth by instantiating :class:`
~email.message.Message` objects and
together via :meth:`attach` and :meth:`set_payload` calls, or they can be
stringing them together via :meth:`attach` and :meth:`set_payload` calls, or they
created by parsing a flat text representation of the email message.
c
an be c
reated by parsing a flat text representation of the email message.
The :mod:`email` package provides a standard parser that understands most email
The :mod:`email` package provides a standard parser that understands most email
document structures, including MIME documents. You can pass the parser a string
document structures, including MIME documents. You can pass the parser a string
or a file object, and the parser will return to you the root
:class:`Message`
or a file object, and the parser will return to you the root
instance of the object structure. For simple, non-MIME messages the payload of
:class:`~email.message.Message` instance of the object structure. For simple,
this root object will likely be a string containing the text of the message.
non-MIME messages the payload of this root object will likely be a string
For MIME messages, the root object will return ``True`` from its
containing the text of the message. For MIME messages, the root object will
:meth:`is_multipart` method, and the subparts can be accessed via th
e
return ``True`` from its :meth:`is_multipart` method, and the subparts can b
e
:meth:`get_payload` and :meth:`walk` methods.
accessed via the
:meth:`get_payload` and :meth:`walk` methods.
There are actually two parser interfaces available for use, the classic
There are actually two parser interfaces available for use, the classic
:class:`Parser` API and the incremental :class:`FeedParser` API. The classic
:class:`Parser` API and the incremental :class:`FeedParser` API. The classic
...
@@ -31,8 +31,8 @@ incrementally, and only returns the root object when you close the parser [#]_.
...
@@ -31,8 +31,8 @@ incrementally, and only returns the root object when you close the parser [#]_.
Note that the parser can be extended in limited ways, and of course you can
Note that the parser can be extended in limited ways, and of course you can
implement your own parser completely from scratch. There is no magical
implement your own parser completely from scratch. There is no magical
connection between the :mod:`email` package's bundled parser and the
connection between the :mod:`email` package's bundled parser and the
:class:`
Message` class, so your custom parser can create message object trees
:class:`
~email.message.Message` class, so your custom parser can create message
any way it finds necessary.
object trees
any way it finds necessary.
FeedParser API
FeedParser API
...
@@ -103,8 +103,8 @@ class.
...
@@ -103,8 +103,8 @@ class.
The constructor for the :class:`Parser` class takes an optional argument
The constructor for the :class:`Parser` class takes an optional argument
*_class*. This must be a callable factory (such as a function or a class), and
*_class*. This must be a callable factory (such as a function or a class), and
it is used whenever a sub-message object needs to be created. It defaults to
it is used whenever a sub-message object needs to be created. It defaults to
:class:`
Message` (see :mod:`email.message`). The factory will be called without
:class:`
~email.message.Message` (see :mod:`email.message`). The factory will
arguments.
be called without
arguments.
The optional *strict* flag is ignored.
The optional *strict* flag is ignored.
...
@@ -199,7 +199,8 @@ Here are some notes on the parsing semantics:
...
@@ -199,7 +199,8 @@ Here are some notes on the parsing semantics:
* All :mimetype:`multipart` type messages will be parsed as a container message
* All :mimetype:`multipart` type messages will be parsed as a container message
object with a list of sub-message objects for their payload. The outer
object with a list of sub-message objects for their payload. The outer
container message will return ``True`` for :meth:`is_multipart` and their
container message will return ``True`` for :meth:`is_multipart` and their
:meth:`get_payload` method will return the list of :class:`Message` subparts.
:meth:`get_payload` method will return the list of :class:`~email.message.Message`
subparts.
* Most messages with a content type of :mimetype:`message/\*` (e.g.
* Most messages with a content type of :mimetype:`message/\*` (e.g.
:mimetype:`message/delivery-status` and :mimetype:`message/rfc822`) will also be
:mimetype:`message/delivery-status` and :mimetype:`message/rfc822`) will also be
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment