PY3 compatibility

This commit is contained in:
Leonel Câmara
2018-06-08 10:41:13 +01:00
committed by GitHub
parent 14083907e5
commit d502275fc8
+3 -3
View File
@@ -1,5 +1,5 @@
import urllib from gluon._compat import urlopen
import urllib2 from gluon._compat import urllib2
import base64 import base64
@@ -17,7 +17,7 @@ def basic_auth(server="http://127.0.0.1"):
headers = {'Authorization': 'Basic ' + key} headers = {'Authorization': 'Basic ' + key}
request = urllib2.Request(server, None, headers) request = urllib2.Request(server, None, headers)
try: try:
urllib2.urlopen(request) urlopen(request)
return True return True
except (urllib2.URLError, urllib2.HTTPError): except (urllib2.URLError, urllib2.HTTPError):
return False return False