MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / __init__

Method __init__

tools/python-3.11.9-amd64/Lib/nntplib.py:315–348  ·  view source on GitHub ↗

Initialize an instance. Arguments: - host: hostname to connect to - port: port to connect to (default the standard NNTP port) - user: username to authenticate with - password: password to use with username - readermode: if true, send 'mode reader' comman

(self, host, port=NNTP_PORT, user=None, password=None,
                 readermode=None, usenetrc=False,
                 timeout=_GLOBAL_DEFAULT_TIMEOUT)

Source from the content-addressed store, hash-verified

313 errors = 'surrogateescape'
314
315 def __init__(self, host, port=NNTP_PORT, user=None, password=None,
316 readermode=None, usenetrc=False,
317 timeout=_GLOBAL_DEFAULT_TIMEOUT):
318 """Initialize an instance. Arguments:
319 - host: hostname to connect to
320 - port: port to connect to (default the standard NNTP port)
321 - user: username to authenticate with
322 - password: password to use with username
323 - readermode: if true, send 'mode reader' command after
324 connecting.
325 - usenetrc: allow loading username and password from ~/.netrc file
326 if not specified explicitly
327 - timeout: timeout (in seconds) used for socket connections
328
329 readermode is sometimes necessary if you are connecting to an
330 NNTP server on the local machine and intend to call
331 reader-specific commands, such as `group'. If you get
332 unexpected NNTPPermanentErrors, you might need to set
333 readermode.
334 """
335 self.host = host
336 self.port = port
337 self.sock = self._create_socket(timeout)
338 self.file = None
339 try:
340 self.file = self.sock.makefile("rwb")
341 self._base_init(readermode)
342 if user or usenetrc:
343 self.login(user, password, usenetrc)
344 except:
345 if self.file:
346 self.file.close()
347 self.sock.close()
348 raise
349
350 def _base_init(self, readermode):
351 """Partial initialization for the NNTP protocol.

Callers 2

__init__Method · 0.45
__init__Method · 0.45

Calls 5

_create_socketMethod · 0.95
_base_initMethod · 0.95
loginMethod · 0.95
makefileMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected