src/oceandata/export_production/mouw.py
def download(datadir=DATADIR, filename="GO_flux.tab"):
    """Download txt file from BATS server
    
    Refs
    ----
    """
    local_filename = os.path.join(datadir, filename)
    try:
        os.unlink(local_filename)
    except FileNotFoundError:
        pass
    try:
        r = requests.get(DATAURL, stream=True, timeout=6, params={"format":"textfile"})
    except requests.ReadTimeout:
        warnings.warn("Connection to server timed out.")
        return False
    if r.ok:
        if local_filename is None:
            return r.text
        else:
            with open(local_filename, 'wb') as f:
                for chunk in r.iter_content(chunk_size=1024): 
                    if chunk:
                        f.write(chunk)
                        f.flush()
    else:
        raise IOError(f"Could not download file from server, Error {r.status_code}")
Download txt file from BATS server
    
    Refs
    ----
    
Download txt file from BATS server
Refs
Download txt file from BATS server Refs
def download(datadir=DATADIR, filename="GO_flux.tab"):
    local_filename = os.path.join(datadir, filename)
    try:
        os.unlink(local_filename)
    except FileNotFoundError:
        pass
    try:
        r = requests.get(DATAURL, stream=True, timeout=6, params={"format":"textfile"})
    except requests.ReadTimeout:
        warnings.warn("Connection to server timed out.")
        return False
    if r.ok:
        if local_filename is None:
            return r.text
        else:
            with open(local_filename, 'wb') as f:
                for chunk in r.iter_content(chunk_size=1024): 
                    if chunk:
                        f.write(chunk)
                        f.flush()
    else:
        raise IOError(f"Could not download file from server, Error {r.status_code}")
def download ( datadir = DATADIR , filename = "GO_flux.tab" ) : local_filename = os . path . join ( datadir , filename ) try : os . unlink ( local_filename ) except FileNotFoundError : pass try : r = requests . get ( DATAURL , stream = True , timeout = 6 , params = { "format" : "textfile" } ) except requests . ReadTimeout : warnings . warn ( "Connection to server timed out." ) return False if r . ok : if local_filename is None : return r . text else : with open ( local_filename , 'wb' ) as f : for chunk in r . iter_content ( chunk_size = 1024 ) : if chunk : f . write ( chunk ) f . flush ( ) else : raise IOError ( f"Could not download file from server, Error {r.status_code}" )
Download txt file from BATS server
Refs
Download txt file from BATS server Refs
"""Download txt file from BATS server
    
    Refs
    ----
    """
datadir
filename