Skip to main content

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.

Source Distribution

tinynetrc-1.1.0.tar.gz (3.8 kB view details)

Uploaded Source

Built Distribution

tinynetrc-1.1.0-py2.py3-none-any.whl (4.5 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file tinynetrc-1.1.0.tar.gz.

File metadata

  • Download URL: tinynetrc-1.1.0.tar.gz
  • Upload date:
  • Size: 3.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for tinynetrc-1.1.0.tar.gz
Algorithm Hash digest
SHA256 e0c768f493be71d77ae084ceea3015c86852a3447d71e3c80cf62b791e41acb6
MD5 ad342ff768d00043b7cf22332138e9d9
BLAKE2b-256 14a1a5cad47c0f8d01a55268551c6c9fbc5df7e8622091a8c6fbe93bda07b91b

See more details on using hashes here.

File details

Details for the file tinynetrc-1.1.0-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for tinynetrc-1.1.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 f7be54016eac0811f6ac256b8ef3b083c3f46e3c15fec08ef681bcc4eedd73c3
MD5 8958f9178a764d50d6a44392c4cb753e
BLAKE2b-256 b9181b93a2f3024277a98672a34325876d41e89f0e753895b00a144b574711d9

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page