Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/modules/ProcUtils.py b/modules/ProcUtils.py
- index edceb41..547fe7b 100644
- --- a/modules/ProcUtils.py
- +++ b/modules/ProcUtils.py
- @@ -6,7 +6,9 @@ SeaDAS library for commonly used functions within other python scripts
- from __future__ import print_function
- import sys
- +import netrc
- +netrc_dict=netrc.netrc()
- # ------------------ DANGER -------------------
- #
- @@ -98,6 +100,7 @@ def _httpdl(url, request, localpath='.', outputfilename=None, ntries=5,
- verbose - get chatty about connection issues (boolean, default False)
- """
- global ofile
- + global netrc_dict
- import os
- import re
- import socket
- @@ -114,6 +117,13 @@ def _httpdl(url, request, localpath='.', outputfilename=None, ntries=5,
- os.umask(0o02)
- os.makedirs(localpath, mode=0o2775)
- + cred=netrc_dict.authenticators(url)
- + if cred is not None:
- + from base64 import b64encode
- + ( _user, _acc, _pass ) = cred
- + userAndPass = b64encode(bytes(_user + ':' + _pass, "utf-8"))
- + reqHeaders.update({ 'Authorization' : 'Basic %s' % userAndPass })
- +
- urlConn, proxy = httpinit(url, timeout=timeout, urlConn=urlConn)
- try:
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement