Lines Matching refs:file
20 To post an article from a file:
21 >>> f = open(filename, 'rb') # file containing article, including header
38 # - the `file` argument to various methods is keyword-only
57 # - NNTP.post() and NNTP.ihave() accept file objects, bytes-like objects and
325 - usenetrc: allow loading username and password from ~/.netrc file
338 self.file = None
340 self.file = self.sock.makefile("rwb")
345 if self.file:
346 self.file.close()
388 is_connected = lambda: hasattr(self, "file")
450 self.file.write(line)
451 self.file.flush()
464 line = self.file.readline(_MAXLINE +1)
493 def _getlongresp(self, file=None):
499 If `file` is a file-like object, it must be open in binary mode.
504 # If a string was passed then open a file with that name
505 if isinstance(file, (str, bytes)):
506 openedFile = file = open(file, "wb")
513 if file is not None:
522 file.write(line)
533 # If this method created the file, then it must close it
545 def _longcmd(self, line, file=None):
549 return self._getlongresp(file)
551 def _longcmdstring(self, line, file=None):
557 resp, list = self._getlongresp(file)
596 def newgroups(self, date, *, file=None):
609 resp, lines = self._longcmdstring(cmd, file)
612 def newnews(self, group, date, *, file=None):
626 return self._longcmdstring(cmd, file)
628 def list(self, group_pattern=None, *, file=None):
631 - file: Filename string or file object to store the result in
640 resp, lines = self._longcmdstring(command, file)
709 def help(self, *, file=None):
711 - file: Filename string or file object to store the result in
717 return self._longcmdstring('HELP', file)
756 def _artcmd(self, line, file=None):
758 resp, lines = self._longcmd(line, file)
762 def head(self, message_spec=None, *, file=None):
765 - file: filename string or file object to store the headers in
774 return self._artcmd(cmd, file)
776 def body(self, message_spec=None, *, file=None):
779 - file: filename string or file object to store the body in
788 return self._artcmd(cmd, file)
790 def article(self, message_spec=None, *, file=None):
793 - file: filename string or file object to store the article in
802 return self._artcmd(cmd, file)
810 def xhdr(self, hdr, str, *, file=None):
814 - file: Filename string or file object to store the result in
820 resp, lines = self._longcmdstring('XHDR {0} {1}'.format(hdr, str), file)
826 def xover(self, start, end, *, file=None):
830 - file: Filename string or file object to store the result in
836 file)
840 def over(self, message_spec, *, file=None):
850 - file: Filename string or file object to store the result in
863 resp, lines = self._longcmdstring(cmd, file)
892 # - we don't want additional CRLF if the file or iterable is already
900 self.file.write(line)
901 self.file.write(b".\r\n")
902 self.file.flush()
907 - data: bytes object, iterable or file containing the article
915 - data: file containing the article
923 if self.file:
924 self.file.close()
925 del self.file
1005 self.file.close()
1007 self.file = self.sock.makefile("rwb")