nntp/nntp.py
def article(self, msgid_article=None, decode=None):
        """ARTICLE command.
        """
        args = None
        if msgid_article is not None:
            args = utils.unparse_msgid_article(msgid_article)

        code, message = self.command("ARTICLE", args)
        if code != 220:
            raise NNTPReplyError(code, message)

        parts = message.split(None, 1)

        try:
            articleno = int(parts[0])
        except ValueError:
            raise NNTPProtocolError(message)

        # headers
        headers = utils.parse_headers(self.info_gen(code, message))

        # decoding setup
        decode = "yEnc" in headers.get("subject", "")
        escape = 0
        crc32 = 0

        # body
        body = []
        for line in self.info_gen(code, message):

            # decode body if required
            if decode:
                if line.startswith("=y"):
                    continue
                line, escape, crc32 = yenc.decode(line, escape, crc32)

            body.append(line)

        return articleno, headers, "".join(body)
def article(self, msgid_article=None, decode=None):
        """ARTICLE command.
        """
        args = None
        if msgid_article is not None:
            args = utils.unparse_msgid_article(msgid_article)

        code, message = self.command("ARTICLE", args)
        if code != 220:
            raise NNTPReplyError(code, message)

        parts = message.split(None, 1)

        try:
            articleno = int(parts[0])
        except ValueError:
            raise NNTPProtocolError(message)

        # headers
        headers = utils.parse_headers(self.info_gen(code, message))

        # decoding setup
        decode = "yEnc" in headers.get("subject", "")
        escape = 0
        crc32 = 0

        # body
        body = []
        for line in self.info_gen(code, message):

            # decode body if required
            if decode:
                if line.startswith("=y"):
                    continue
                line, escape, crc32 = yenc.decode(line, escape, crc32)

            body.append(line)

        return articleno, headers, "".join(body)
ARTICLE command.