Commit ed1180a7 authored by Patrick Godwin's avatar Patrick Godwin

influx.py: check non-default .netrc location if NETRC set

parent 1d6635ad
Pipeline #83151 passed with stages
in 4 minutes and 5 seconds
......@@ -1141,7 +1141,12 @@ def create_client(host='localhost', port=8086, auth=False, https=False):
user = os.getenv('INFLUX_USERNAME')
password = os.getenv('INFLUX_PASSWORD')
if not user:
netrc_info = netrc.netrc()
### look at default location for .netrc unless NETRC set
if 'NETRC' in os.environ:
netrc_info = netrc.netrc(os.getenv('NETRC'))
else:
netrc_info = netrc.netrc()
auth_entry = netrc_info.authenticators(host)
if auth_entry:
user, _, password = auth_entry
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment