Skip to content

Commit

Permalink
Set HTTP.NETRC if .netrc file found
Browse files Browse the repository at this point in the history
  • Loading branch information
magnusuMET committed Oct 29, 2024
1 parent d203d8b commit 32e313d
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/netCDF4/_netCDF4.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -1318,6 +1318,15 @@ if __has_nc_rc_set__:
if nc_rc_set("HTTP.SSL.CAINFO", _strencode(certifi.where())) != 0:
raise RuntimeError('error setting path to SSL certificates')

# set .netrc if availble in cwd or home (issue #1299)
if __has_nc_rc_set__:
filename = ".netrc"
for path in [pathlib.Path(filename), pathlib.Path.home().joinpath(filename)]:
if path.exists():
if nc_rc_set("HTTP.NETRC", _strencode(path)) != 0:
raise RuntimeError('error setting path to .netrc file')
break

def rc_get(key):
"""
**```rc_get(key)```**
Expand Down

0 comments on commit 32e313d

Please sign in to comment.