13.4. "netrc" — traitement de fichier *netrc*
*********************************************

Nouveau dans la version 1.5.2.

**Code source :** Lib/netrc.py

======================================================================

The "netrc" class parses and encapsulates the netrc file format used
by the Unix **ftp** program and other FTP clients.

class netrc.netrc([file])

   A "netrc" instance or subclass instance encapsulates data from  a
   netrc file.  The initialization argument, if present, specifies the
   file to parse.  If no argument is given, the file ".netrc" in the
   user’s home directory will be read.  Parse errors will raise
   "NetrcParseError" with diagnostic information including the file
   name, line number, and terminating token. If no argument is
   specified on a POSIX system, the presence of passwords in the
   ".netrc" file will raise a "NetrcParseError" if the file ownership
   or permissions are insecure (owned by a user other than the user
   running the process, or accessible for read or write by any other
   user). This implements security behavior equivalent to that of ftp
   and other programs that use ".netrc".

   Modifié dans la version 2.7.6: Added the POSIX permissions check.

exception netrc.NetrcParseError

   Exception raised by the "netrc" class when syntactical errors are
   encountered in source text.  Instances of this exception provide
   three interesting attributes:  "msg" is a textual explanation of
   the error, "filename" is the name of the source file, and "lineno"
   gives the line number on which the error was found.


13.4.1. Objets *netrc*
======================

A "netrc" instance has the following methods:

netrc.authenticators(host)

   Renvoie un triplet "(login, account, password)" pour s’authentifier
   auprès de l’hôte *host*. Si le fichier *netrc* ne contient pas
   d’entrée pour l’hôte donné, renvoie le tuple associé à l’entrée par
   défaut. Si aucun hôte correspondant ni aucune entrée par défaut
   n’est disponible, renvoie "None".

netrc.__repr__()

   Déverse les données de la classe sous forme de chaîne dans le
   format d’un fichier *netrc*. (Ceci ignore les commentaires et peut
   réorganiser les entrées).

Instances of "netrc" have public instance variables:

netrc.hosts

   Dictionnaire faisant correspondre les noms d’hôtes dans des tuples
   "(login, account, password)". L’entrée par défaut, le cas échéant,
   est représentée en tant que pseudo-hôte par ce nom.

netrc.macros

   Dictionnaire faisant correspondre les noms de macro en listes de
   chaînes.

Note: Passwords are limited to a subset of the ASCII character set.
  Versions of this module prior to 2.3 were extremely limited.
  Starting with 2.3, all ASCII punctuation is allowed in passwords.
  However, note that whitespace and non-printable characters are not
  allowed in passwords.  This is a limitation of the way the .netrc
  file is parsed and may be removed in the future.
