-
-
Notifications
You must be signed in to change notification settings - Fork 33k
Open
Labels
stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-featureA feature request or enhancementA feature request or enhancement
Description
Feature or enhancement
Make netrc class accept open file object (io.TextIOBase subclass) as an initialization argument.
Pitch
Providing netrc data via StringIO makes it possible to retrieve it from a verity of different sources e.g. an encrypted file. With few additional lines lines of code .netrc
becomes a secure password store.
import gpg
with open(file) as file_gpg:
with gpg.Context() as c:
plaintext = c.decrypt(file_gpg)[0]
nrc_data = io.StringIO(plaintext.decode('utf-8'))
nrc = netrc.netrc(nrc_data)
passwd = nrc.authenticators(hostname)[2]
Metadata
Metadata
Assignees
Labels
stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-featureA feature request or enhancementA feature request or enhancement