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.2.0.tar.gz (4.0 kB view details)

Uploaded Source

Built Distribution

tinynetrc-1.2.0-py2.py3-none-any.whl (4.4 kB view details)

Uploaded Python 2 Python 3

File details

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

File metadata

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

File hashes

Hashes for tinynetrc-1.2.0.tar.gz
Algorithm Hash digest
SHA256 07dad8bdf669e5fe9cc62fd1d73e288d842882c64d0091593c40a0651f242871
MD5 905e68e3f02703477ed4e5efc9fb519e
BLAKE2b-256 d6a78e5075e381c164b59f9b76e22c5f63c3b015655f85794b4d9059b71784c3

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for tinynetrc-1.2.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 e36e8fe1c4b38ec50526d364940709e45e879a1ad4cac148cf9afe613ed37876
MD5 21fa16c672c428822378dfd8d548681c
BLAKE2b-256 e042ece8d5a72f34fb6a5df57b445d99021fd708ecddc93795d9e1e00f001c1c

See more details on using hashes here.

Provenance

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