Skip to main content
Help the Python Software Foundation raise $60,000 USD by December 31st!  Building the PSF Q4 Fundraiser

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.5.


from tinynetrc import Netrc

netrc = Netrc()  # parse ~/.netrc
# Get credentials

# Modify an existing entry
netrc['']['password'] = 'newpassword'  # writes to ~/.netrc

# Add a new entry
netrc[''] = {
    'login': '',
    'password': 'secret'

# Removing an new entry
del netrc['']

You can also use Netrc as a context manager, which will automatically save ~/.netrc.

from tinynetrc import Netrc
with Netrc() as netrc:
    netrc['']['password'] = 'newpassword'
    assert netrc.is_dirty is True
# saved!


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.

Files for tinynetrc, version 1.3.0
Filename, size File type Python version Upload date Hashes
Filename, size tinynetrc-1.3.0-py2.py3-none-any.whl (3.9 kB) File type Wheel Python version py2.py3 Upload date Hashes View
Filename, size tinynetrc-1.3.0.tar.gz (4.5 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page