PY3 compatibility
This commit is contained in:
1 parent
14083907e5
commit
d502275fc8
1 file changed
+3
-3
@@ -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
|
||||||
|
|||||||
Reference in new issue
Block a user