(self, file=None)
return resp, lines
Internal: get a response plus following text from the server.
        Raise various errors if the response indicates an error.

        Returns a (response, lines) tuple where `response` is a unicode
        string and `lines` is a list of bytes objects.
        If `file` is a file-like object, it must be open in binary mode.
Internal: get a response plus following text from the server.
        Raise various errors if the response indicates an error.
Internal : get a response plus following text from the server . Raise various errors if the response indicates an error .
def _getlongresp(self, file=None):
        """Internal: get a response plus following text from the server.
        Raise various errors if the response indicates an error.

        Returns a (response, lines) tuple where `response` is a unicode
        string and `lines` is a list of bytes objects.
        If `file` is a file-like object, it must be open in binary mode.
        """

        openedFile = None
        try:
            # If a string was passed then open a file with that name
            if isinstance(file, (str, bytes)):
                openedFile = file = open(file, "wb")

            resp = self._getresp()
            if resp[:3] not in _LONGRESP:
                raise NNTPReplyError(resp)

            lines = []
            if file is not None:
                # XXX lines = None instead?
                terminators = (b'.' + _CRLF, b'.\n')
                while 1:
                    line = self._getline(False)
                    if line in terminators:
                        break
                    if line.startswith(b'..'):
                        line = line[1:]
                    file.write(line)
            else:
                terminator = b'.'
                while 1:
                    line = self._getline()
                    if line == terminator:
                        break
                    if line.startswith(b'..'):
                        line = line[1:]
                    lines.append(line)
        finally:
            # If this method created the file, then it must close it
            if openedFile:
                openedFile.close()

        return resp, lines
def _getlongresp ( self , file = None ) : openedFile = None try : # If a string was passed then open a file with that name if isinstance ( file , ( str , bytes ) ) : openedFile = file = open ( file , "wb" ) resp = self . _getresp ( ) if resp [ : 3 ] not in _LONGRESP : raise NNTPReplyError ( resp ) lines = [ ] if file is not None : # XXX lines = None instead? terminators = ( b'.' + _CRLF , b'.\n' ) while 1 : line = self . _getline ( False ) if line in terminators : break if line . startswith ( b'..' ) : line = line [ 1 : ] file . write ( line ) else : terminator = b'.' while 1 : line = self . _getline ( ) if line == terminator : break if line . startswith ( b'..' ) : line = line [ 1 : ] lines . append ( line ) finally : # If this method created the file, then it must close it if openedFile : openedFile . close ( ) return resp , lines