Read and write .netrc files.
Project description
Read and write .netrc files in Python.
tinynetrc uses the netrc module from the standard library under the hood and adds a few improvements:
Adds write functionality.
Fixes a std lib bug with formatting a .netrc file.*
Parses .netrc into dictionary values rather than tuples.
*This bug is fixed in Python 3.7 but still exists in older versions.
Get it now
pip install tinynetrc
tinynetrc supports Python >= 2.7 or >= 3.4.
Usage
from tinynetrc import Netrc
netrc = Netrc() # parse ~/.netrc
netrc.machines['api.heroku.com']['password'] # get auth token
# Modify an existing entry
netrc.machines['api.heroku.com']['password'] = 'newpassword'
netrc.save() # writes to ~/.netrc
# Add a new entry
netrc.machines['surge.surge.sh'] = {
'login': 'sloria1@gmail.com',
'password': 'secret'
}
netrc.save()
# Removing an new entry
del netrc.machines['surge.surge.sh']
netrc.save()
License
MIT licensed. See the bundled LICENSE file for more details.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
tinynetrc-1.0.0.tar.gz
(3.6 kB
view hashes)
Built Distribution
Close
Hashes for tinynetrc-1.0.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d6bfe0d2925ee940c95f71a2ffeb90f3f1ec1306ab6f02307c67bf0256350813 |
|
MD5 | 0f592a42cce54d962ef67feb7ff1a077 |
|
BLAKE2b-256 | b76fa3cba6fe46a24b382e5cd6482467b99020f56390e3780ce79065febc832b |