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 30, 2024
1 parent d203d8b commit ab08bba
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/netCDF4/_netCDF4.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -1318,6 +1318,14 @@ 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__:
for path in [pathlib.Path(".netrc"), pathlib.Path.home().joinpath(".netrc")]:
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 ab08bba

Please sign in to comment.