N
news.corp.adobe.com
I need to perform basic authentication and I also need to be able to use the
put and delete methods to copy files / delete files on a server.
Here is how I successfully perform basic authentication to read a page:
------------------------------------------------
import urllib2, os, base64
os.system("cls")
theurl = 'http://myurl.com:9090/ESG/en_US/GLtest/'
username = 'myusername'
password = 'mypassword'
req = urllib2.Request(theurl)
realm = 'Apache Tomcat/4.1.27'
base64string = base64.encodestring('%s:%s' % (username, password))[:-1]
authheader = "Basic %s" % base64string
req.add_header("Authorization", authheader)
handle = urllib2.urlopen(req)
thepage = handle.read()
print thepage
put and delete methods to copy files / delete files on a server.
Here is how I successfully perform basic authentication to read a page:
------------------------------------------------
import urllib2, os, base64
os.system("cls")
theurl = 'http://myurl.com:9090/ESG/en_US/GLtest/'
username = 'myusername'
password = 'mypassword'
req = urllib2.Request(theurl)
realm = 'Apache Tomcat/4.1.27'
base64string = base64.encodestring('%s:%s' % (username, password))[:-1]
authheader = "Basic %s" % base64string
req.add_header("Authorization", authheader)
handle = urllib2.urlopen(req)
thepage = handle.read()
print thepage