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)
- #!/bin/bash
- cd # path to output files
- touch .netrc
- echo "machine urs.earthdata.nasa.gov login <username> password <password>" >> .netrc
- chmod 0600 .netrc
- touch .urs_cookies
- wget --content-disposition --trust-server-names --load-cookies ~/.urs_cookies --save-cookies ~/.urs_cookies --auth-no-challenge=on --keep-session-cookies
- -i <path to text file of url list>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement