netrc: accept open file object as initialization argument
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 77.2k
- Forks
- 36k
- PR merge metrics
- PR metrics pending
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]
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the netrc.netrc initialization entry point and compare its current argument handling with the provided io.StringIO example. Confirm how an open io.TextIOBase object should be consumed without changing existing inputs, then verify that parsing and authenticator lookup still produce the expected results.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100