Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import requests
- def httpdownload():
- '''loop through each line in the text file and open url'''
- httpfile = open(pathlist[0]+"NASAdownloadSample.txt", "r")
- for line in httpfile:
- print line
- outname = line[-134:-122]+".hdf"
- print outname
- username = ""
- password = "*"
- r = requests.get(line, auth=("username", "password"), stream=True)
- print r.text
- print r.status_code
- with open(pathlist[0]+outname, 'wb') as out:
- out.write(r.content)
- print outname, "finished" # keep track of progress
- import install_cas_client
- from pydap.client import open_url
- def httpdownload():
- '''loop through each line in the text file and open url'''
- username = ""
- password = ""
- httpfile = open(pathlist[0]+"NASAdownloadSample.txt", "r")
- fileone = httpfile.readline()
- filetot = fileone[:7]+username+":"+password+"@"+fileone[7:]
- print filetot
- dataset = open_url(filetot)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement