Lines Matching +full:post +full:- +full:dates
2 - RFC 977: Network News Transfer Protocol
3 - RFC 2980: Common NNTP Extensions
4 - RFC 3977: Network News Transfer Protocol (version 2)
13 >>> resp, subs = s.xhdr('subject', '{0}-{1}'.format(first, last))
20 To post an article from a file:
22 >>> resp = s.post(f)
34 # - all commands are encoded as UTF-8 data (using the "surrogateescape"
35 # error handler), except for raw message data (POST, IHAVE)
36 # - all responses are decoded as UTF-8 data (using the "surrogateescape"
38 # - the `file` argument to various methods is keyword-only
40 # - NNTP.date() returns a datetime object
41 # - NNTP.newgroups() and NNTP.newnews() take a datetime (or date) object,
43 # - NNTP.newgroups() and NNTP.list() return a list of GroupInfo named tuples
44 # - NNTP.descriptions() returns a dict mapping group names to descriptions
45 # - NNTP.xover() returns a list of dicts mapping field names (header or metadata)
47 # - NNTP.article(), NNTP.head() and NNTP.body() return a (response, ArticleInfo)
49 # - the "internal" methods have been marked private (they now start with
53 # - automatic querying of capabilities at connect
54 # - New method NNTP.getcapabilities()
55 # - New method NNTP.over()
56 # - New helper function decode_header()
57 # - NNTP.post() and NNTP.ihave() accept file objects, bytes-like objects and
59 # - An extensive test suite :-)
62 # - return structured data (GroupInfo etc.) everywhere
63 # - support HDR
118 """Response does not begin with [1-5]"""
134 '211', # LISTGROUP (also not multi-line with GROUP)
148 "subject", "from", "date", "message-id", "references", ":bytes", ":lines"]
169 and decodes it as a (possibly non-ASCII) readable value."""
221 # Non-default header names are included in full in the response
238 time_str = date_str[-6:]
239 date_str = date_str[:-6]
243 year = int(date_str[:-4])
244 month = int(date_str[-4:-2])
245 day = int(date_str[-2:])
246 # RFC 3977 doesn't say how to interpret 2-char years. Assume that
247 # there are no dates before 1970 on Usenet.
284 - sock: Socket to wrap
285 - context: SSL context to use for the encrypted connection
287 - sock: New, encrypted socket.
297 # UTF-8 is the character set for all NNTP commands and responses: they
300 # However, some multi-line data blocks can contain arbitrary bytes (for
301 # example, latin-1 or utf-16 data in the body of a message). Commands
302 # taking (POST, IHAVE) or returning (HEAD, BODY, ARTICLE) raw message
304 # Furthermore, since there could be non-compliant servers out there,
306 # and easy round-tripping. This could be useful for some applications
309 encoding = 'utf-8'
316 - host: hostname to connect to
317 - port: port to connect to (default the standard NNTP port)
318 - user: username to authenticate with
319 - password: password to use with username
320 - readermode: if true, send 'mode reader' command after
322 - usenetrc: allow loading username and password from ~/.netrc file
324 - timeout: timeout (in seconds) used for socket connections
328 reader-specific commands, such as `group'. If you get
397 raise ValueError('Non-blocking socket (timeout=0) is not supported')
443 The `line` must be a bytes-like object."""
468 if line[-2:] == _CRLF:
469 line = line[:-2]
470 elif line[-1:] in _CRLF:
471 line = line[:-1]
496 If `file` is a file-like object, it must be open in binary mode.
582 - resp: server response if successful
583 - caps: a dictionary mapping capability names to lists of tokens
595 - date: a date or datetime object
597 - resp: server response if successful
598 - list: list of newsgroup names
611 - group: group name or '*'
612 - date: a date or datetime object
614 - resp: server response if successful
615 - list: list of message ids
627 - group_pattern: a pattern indicating which groups to query
628 - file: Filename string or file object to store the result in
630 - resp: server response if successful
631 - list: list of (group, last, first, flag) (strings)
682 - group: the group name
684 - resp: server response if successful
685 - count: number of articles
686 - first: first article number
687 - last: last article number
688 - name: the group name
708 - file: Filename string or file object to store the result in
710 - resp: server response if successful
711 - list: list of strings returned by the server in response to the
733 - message_spec: article number or message id (if not specified,
736 - resp: server response if successful
737 - art_num: the article number
738 - message_id: the message id
761 - message_spec: article number or message id
762 - file: filename string or file object to store the headers in
764 - resp: server response if successful
765 - ArticleInfo: (article number, message id, list of header lines)
775 - message_spec: article number or message id
776 - file: filename string or file object to store the body in
778 - resp: server response if successful
779 - ArticleInfo: (article number, message id, list of body lines)
789 - message_spec: article number or message id
790 - file: filename string or file object to store the article in
792 - resp: server response if successful
793 - ArticleInfo: (article number, message id, list of article lines)
803 - resp: server response if successful
809 - hdr: the header type (e.g. 'subject')
810 - str: an article nr, a message id, or a range nr1-nr2
811 - file: Filename string or file object to store the result in
813 - resp: server response if successful
814 - list: list of (nr, value) strings
816 pat = re.compile('^([0-9]+) ?(.*)\n?')
825 - start: start of range
826 - end: end of range
827 - file: Filename string or file object to store the result in
829 - resp: server response if successful
830 - list: list of dicts containing the response fields
832 resp, lines = self._longcmdstring('XOVER {0}-{1}'.format(start, end),
840 - message_spec:
841 - either a message id, indicating the article to fetch
843 - or a (start, end) tuple, indicating a range of article numbers;
846 - or None, indicating the current article number must be used
847 - file: Filename string or file object to store the result in
849 - resp: server response if successful
850 - list: list of dicts containing the response fields
857 cmd += ' {0}-{1}'.format(start, end or '')
867 - resp: server response if successful
868 - date: datetime object
889 # - we don't want additional CRLF if the file or iterable is already
891 # - we don't want a spurious flush() after each line is written
902 def post(self, data): member in NNTP
903 """Process a POST command. Arguments:
904 - data: bytes object, iterable or file containing the article
906 - resp: server response if successful"""
907 return self._post('POST', data)
911 - message_id: message-id of the article
912 - data: file containing the article
914 - resp: server response if successful
928 - resp: server response if successful"""
992 - context: SSL context to use for the encrypted connection
1046 nntplib built-in demo - display the latest articles in a newsgroup""")
1047 parser.add_argument('-g', '--group', default='gmane.comp.python.general',
1049 parser.add_argument('-s', '--server', default='news.gmane.io',
1051 parser.add_argument('-p', '--port', default=-1, type=int,
1053 parser.add_argument('-n', '--nb-articles', default=10, type=int,
1055 parser.add_argument('-S', '--ssl', action='store_true', default=False,
1061 if port == -1:
1065 if port == -1:
1077 s = s[:lim - 4] + "..."
1080 first = str(int(last) - args.nb_articles + 1)