mirror of
https://github.com/python/cpython.git
synced 2025-09-19 07:00:59 +00:00
Merged revisions 84592 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k ........ r84592 | antoine.pitrou | 2010-09-07 20:44:12 +0200 (mar., 07 sept. 2010) | 5 lines Update nntplib examples to use a public news server. The example still doesn't work as-is under py3k, due to incomplete or buggy porting of the nntplib module. ........
This commit is contained in:
parent
f4f6171bc0
commit
d47a68716e
1 changed files with 17 additions and 17 deletions
|
@ -18,35 +18,35 @@ Protocol), see Internet :rfc:`977`.
|
||||||
Here are two small examples of how it can be used. To list some statistics
|
Here are two small examples of how it can be used. To list some statistics
|
||||||
about a newsgroup and print the subjects of the last 10 articles::
|
about a newsgroup and print the subjects of the last 10 articles::
|
||||||
|
|
||||||
>>> s = NNTP('news.cwi.nl')
|
>>> s = NNTP('news.gmane.org')
|
||||||
>>> resp, count, first, last, name = s.group('comp.lang.python')
|
>>> resp, count, first, last, name = s.group('gmane.comp.python.committers')
|
||||||
>>> print 'Group', name, 'has', count, 'articles, range', first, 'to', last
|
>>> print 'Group', name, 'has', count, 'articles, range', first, 'to', last
|
||||||
Group comp.lang.python has 59 articles, range 3742 to 3803
|
Group gmane.comp.python.committers has 1071 articles, range 1 to 1071
|
||||||
>>> resp, subs = s.xhdr('subject', first + '-' + last)
|
>>> resp, subs = s.xhdr('subject', first + '-' + last)
|
||||||
>>> for id, sub in subs[-10:]: print id, sub
|
>>> for id, sub in subs[-10:]: print id, sub
|
||||||
...
|
...
|
||||||
3792 Re: Removing elements from a list while iterating...
|
1062 Re: Mercurial Status?
|
||||||
3793 Re: Who likes Info files?
|
1063 Re: [python-committers] (Windows) buildbots on 3.x
|
||||||
3794 Emacs and doc strings
|
1064 Re: Mercurial Status?
|
||||||
3795 a few questions about the Mac implementation
|
1065 Re: Mercurial Status?
|
||||||
3796 Re: executable python scripts
|
1066 Python 2.6.6 status
|
||||||
3797 Re: executable python scripts
|
1067 Commit Privileges for Ask Solem
|
||||||
3798 Re: a few questions about the Mac implementation
|
1068 Re: Commit Privileges for Ask Solem
|
||||||
3799 Re: PROPOSAL: A Generic Python Object Interface for Python C Modules
|
1069 Re: Commit Privileges for Ask Solem
|
||||||
3802 Re: executable python scripts
|
1070 Re: Commit Privileges for Ask Solem
|
||||||
3803 Re: \POSIX{} wait and SIGCHLD
|
1071 2.6.6 rc 2
|
||||||
>>> s.quit()
|
>>> s.quit()
|
||||||
'205 news.cwi.nl closing connection. Goodbye.'
|
'205 Bye!'
|
||||||
|
|
||||||
To post an article from a file (this assumes that the article has valid
|
To post an article from a file (this assumes that the article has valid
|
||||||
headers)::
|
headers, and that you have right to post on the particular newsgroup)::
|
||||||
|
|
||||||
>>> s = NNTP('news.cwi.nl')
|
>>> s = NNTP('news.gmane.org')
|
||||||
>>> f = open('/tmp/article')
|
>>> f = open('/tmp/article')
|
||||||
>>> s.post(f)
|
>>> s.post(f)
|
||||||
'240 Article posted successfully.'
|
'240 Article posted successfully.'
|
||||||
>>> s.quit()
|
>>> s.quit()
|
||||||
'205 news.cwi.nl closing connection. Goodbye.'
|
'205 Bye!'
|
||||||
|
|
||||||
The module itself defines the following items:
|
The module itself defines the following items:
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue