Skip to main content
Join the official Python Developers Survey 2018 and win valuable prizes: Start the survey!

Read and write .netrc files.

Project description

Latest version Travis-CI

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 newer versions of Python.

Get it now

pip install tinynetrc

tinynetrc supports Python >= 2.7 or >= 3.4.

Usage

from tinynetrc import Netrc

netrc = Netrc()  # parse ~/.netrc
# Get credentials
netrc['api.heroku.com']['login']
netrc['api.heroku.com']['password']

# Modify an existing entry
netrc['api.heroku.com']['password'] = 'newpassword'
netrc.save()  # writes to ~/.netrc

# Add a new entry
netrc['surge.surge.sh'] = {
    'login': 'sloria1@gmail.com',
    'password': 'secret'
}
netrc.save()

# Removing an new entry
del netrc['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.

Filename, size & hash SHA256 hash help File type Python version Upload date
tinynetrc-1.2.0-py2.py3-none-any.whl (4.4 kB) Copy SHA256 hash SHA256 Wheel py2.py3 Jan 12, 2018
tinynetrc-1.2.0.tar.gz (4.0 kB) Copy SHA256 hash SHA256 Source None Jan 12, 2018

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page