Advertisement
Guest User

Untitled

a guest
Oct 14th, 2016
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. import requests
  2.  
  3. def httpdownload():
  4. '''loop through each line in the text file and open url'''
  5. httpfile = open(pathlist[0]+"NASAdownloadSample.txt", "r")
  6. for line in httpfile:
  7. print line
  8. outname = line[-134:-122]+".hdf"
  9. print outname
  10. username = ""
  11. password = "*"
  12. r = requests.get(line, auth=("username", "password"), stream=True)
  13. print r.text
  14. print r.status_code
  15. with open(pathlist[0]+outname, 'wb') as out:
  16. out.write(r.content)
  17. print outname, "finished" # keep track of progress
  18.  
  19. import install_cas_client
  20. from pydap.client import open_url
  21.  
  22. def httpdownload():
  23. '''loop through each line in the text file and open url'''
  24. username = ""
  25. password = ""
  26. httpfile = open(pathlist[0]+"NASAdownloadSample.txt", "r")
  27. fileone = httpfile.readline()
  28. filetot = fileone[:7]+username+":"+password+"@"+fileone[7:]
  29. print filetot
  30. dataset = open_url(filetot)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement