Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import urllib2
- username = 's5pguest'
- password = 's5pguest'
- #This should be the base url you wanted to access.
- baseurl = "https://s5phub.copernicus.eu/dhus/odata/v1/Products('56c22bb9-f91d-40de-9bc8-3ddf23fc2fb0')/$value"
- #Create a password manager
- manager = urllib2.HTTPPasswordMgrWithDefaultRealm()
- manager.add_password(None, baseurl, username, password)
- #Create an authentication handler using the password manager
- auth = urllib2.HTTPBasicAuthHandler(manager)
- #Create an opener that will replace the default urlopen method on further calls
- opener = urllib2.build_opener(auth)
- urllib2.install_opener(opener)
- #Here you should access the full url you wanted to open
- response = urllib2.urlopen(baseurl + "/file")
Add Comment
Please, Sign In to add comment