Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
a0781154
Kaydet (Commit)
a0781154
authored
14 years ago
tarafından
Antoine Pitrou
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #10282: Add a `nntp_implementation` attribute to NNTP objects.
üst
09fff7a8
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
41 additions
and
12 deletions
+41
-12
nntplib.rst
Doc/library/nntplib.rst
+34
-12
nntplib.py
Lib/nntplib.py
+3
-0
test_nntplib.py
Lib/test/test_nntplib.py
+2
-0
NEWS
Misc/NEWS
+2
-0
No files found.
Doc/library/nntplib.rst
Dosyayı görüntüle @
a0781154
...
...
@@ -54,7 +54,7 @@ The module itself defines the following classes:
.. class:: NNTP(host, port=119, user=None, password=None, readermode=None, usenetrc=True, [timeout])
Return a new
instance of the :class:`NNTP` class
, representing a connection
Return a new
:class:`NNTP` object
, representing a connection
to the NNTP server running on host *host*, listening at port *port*.
An optional *timeout* can be specified for the socket connection.
If the optional *user* and *password* are provided, or if suitable
...
...
@@ -111,19 +111,41 @@ The module itself defines the following classes:
NNTP Objects
------------
:class:`NNTP` instances have the following methods. The *response* that is
returned as the first item in the return tuple of almost all methods is the
server's response: a string beginning with a three-digit code. If the server's
response indicates an error, the method raises one of the above exceptions.
When connected, :class:`NNTP` objects support the following methods and
attributes.
.. note::
Many of the following methods take an optional keyword-only argument *file*.
When the *file* argument is supplied, it must be either a :term:`file object`
opened for binary writing, or the name of an on-disk file to be written to.
The method will then write any data returned by the server (except for the
response line and the terminating dot) to the file; any list of lines,
tuples or objects that the method normally returns will be empty.
Attributes
^^^^^^^^^^
.. attribute:: NNTP.nntp_version
An integer representing the version of the NNTP protocol supported by the
server. In practice, this should be ``2`` for servers advertising
:rfc:`3977` compliance and ``1`` for others.
.. versionadded:: 3.2
.. attribute:: NNTP.nntp_implementation
A string describing the software name and version of the NNTP server,
or :const:`None` if not advertised by the server.
.. versionadded:: 3.2
Methods
^^^^^^^
The *response* that is returned as the first item in the return tuple of almost
all methods is the server's response: a string beginning with a three-digit
code. If the server's response indicates an error, the method raises one of
the above exceptions.
Many of the following methods take an optional keyword-only argument *file*.
When the *file* argument is supplied, it must be either a :term:`file object`
opened for binary writing, or the name of an on-disk file to be written to.
The method will then write any data returned by the server (except for the
response line and the terminating dot) to the file; any list of lines,
tuples or objects that the method normally returns will be empty.
.. versionchanged:: 3.2
Many of the following methods have been reworked and fixed, which makes
...
...
This diff is collapsed.
Click to expand it.
Lib/nntplib.py
Dosyayı görüntüle @
a0781154
...
...
@@ -354,6 +354,7 @@ class _NNTPBase:
# Inquire about capabilities (RFC 3977)
self
.
nntp_version
=
1
self
.
nntp_implementation
=
None
try
:
resp
,
caps
=
self
.
capabilities
()
except
NNTPPermanentError
:
...
...
@@ -365,6 +366,8 @@ class _NNTPBase:
# The server can advertise several supported versions,
# choose the highest.
self
.
nntp_version
=
max
(
map
(
int
,
caps
[
'VERSION'
]))
if
'IMPLEMENTATION'
in
caps
:
self
.
nntp_implementation
=
' '
.
join
(
caps
[
'IMPLEMENTATION'
])
def
getwelcome
(
self
):
"""Get the welcome message from the server
...
...
This diff is collapsed.
Click to expand it.
Lib/test/test_nntplib.py
Dosyayı görüntüle @
a0781154
...
...
@@ -949,6 +949,7 @@ class NNTPv1Tests(NNTPv1v2TestsMixin, MockedNNTPTestsMixin, unittest.TestCase):
caps
=
self
.
server
.
getcapabilities
()
self
.
assertEqual
(
caps
,
{})
self
.
assertEqual
(
self
.
server
.
nntp_version
,
1
)
self
.
assertEqual
(
self
.
server
.
nntp_implementation
,
None
)
class
NNTPv2Tests
(
NNTPv1v2TestsMixin
,
MockedNNTPTestsMixin
,
unittest
.
TestCase
):
...
...
@@ -971,6 +972,7 @@ class NNTPv2Tests(NNTPv1v2TestsMixin, MockedNNTPTestsMixin, unittest.TestCase):
'READER'
:
[],
})
self
.
assertEqual
(
self
.
server
.
nntp_version
,
3
)
self
.
assertEqual
(
self
.
server
.
nntp_implementation
,
'INN 2.5.1'
)
class
MiscTests
(
unittest
.
TestCase
):
...
...
This diff is collapsed.
Click to expand it.
Misc/NEWS
Dosyayı görüntüle @
a0781154
...
...
@@ -65,6 +65,8 @@ Core and Builtins
Library
-------
- Issue #10282: Add a ``nntp_implementation`` attribute to NNTP objects.
- Issue #10283: Add a ``group_pattern`` argument to NNTP.list().
- Issue #10155: Add IISCGIHandler to wsgiref.handlers to support IIS
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment