Skip to main content

netrcli - cli for .netrc file

netrcli is a small command line tool to work with entries in .netrc file. As the .netrc file support is implemented in many tools, like ftp, curl, pip, and wget, this tool targets to help the use of those tools with authenticated services, like GitLab.

The credentials are stored in plaintext in the .netrc file.

This is the way .netrc is. You have been warned.

In the background netrcli extends python standard library netrc implementation.

Installation

Install the command line tool from with pipx:

pipx install netrcli

Alternatively use pip for the installation:

pip install netrcli

Either way, to check the installation and netrcli version, run:

netrcli --version

If you see a version in the terminal, you're good to go!

Usage

When in doubt, try

netrcli --help

The tool uses ~/.netrc file. If such does not exist, it will be created to the home directory of the current user.

Updating entries in .netrc file

To add or modify the entry of myhost.com in the .netrc file, run

netrcli update --login user@name.com --password qwerty123 myhost.com

Use in GitLab pipelines

To add GitLab credentials in the .netrc file during GitLab jobs, run

netrcli update --gitlab-ci

in the GitLab job. This adds an entry in the .netrc file with using environment variables CI_SERVER_HOST CI_REGISTRY_USER, and CI_JOB_TOKEN. Now you can use for example curl to fetch packages from GitLab package registry with just --netrc argument set.

Note, that curl only supports HTTP basic authentication with the credentials from .netrc file with ``--netrc` argument.

Most of the endpoints in GitLab do not support HTTP basic authentication for authentication, but for example generic package registry does support it.

Get information from .netrc file

To get a stored login (username) to the standard output for a specific host from the .netrc file, run

netrcli get --login myhost.com

To get the stored password of the host, run:

netrcli get --password myhost.com

And to get the stored password of the host formatted in OAuth 2.0 authorization header, run

netrcli get --oauth-bearer myhost.com

This may be handy for example with curl --header "$(netrcli get --oauth-bearer myhost.com)" myhost.com/something.

Delete an entry from .netrc file

To delete an entry of a host in .netrc file, run

netrcli delete myhost.com

Metadata

Release files for netrcli 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for netrcli 0.2.0
File Size Uploaded Provenance
netrcli-0.2.0.tar.gz 5.9 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for netrcli 0.2.0
File Interpreter ABI Platform
netrcli-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 11.9 kB

Release files / netrcli-0.2.0.tar.gz

Download URL netrcli-0.2.0.tar.gz
Size 5.9 kB
Tags Source
SHA-256 checksum
How to use checksums
a9d82144736bda6bafd71e7f7cffba6a783acf84696d24e04204e0de3722f782
BLAKE2b-256 checksum
How to use checksums
905fb1c33c03429087cf5aa9bb556ef76b43dc62eb478752513bf218cb1087e6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.15

Release files / netrcli-0.2.0-py3-none-any.whl

Download URL netrcli-0.2.0-py3-none-any.whl
Size 6.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b9acbd355b2dedd40656609618756b329b86e212beb46f87e22849b5974b6465
BLAKE2b-256 checksum
How to use checksums
9d3e250e54e223d5100a93c07be2662dcaccd29d1be731705042e60e56117b79
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.15

Security for netrcli 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page