hi, not to waste time, plz tell me how should i use this code in controller
default.py :
it works in python well but in web2py error..error..error
from urllib2 import Request, urlopen, URLError
url = request.vars.url
req = Request(url)
try:
response = urlopen(req)
except URLError, e:
if hasattr(e, 'reason'):
print 'We failed to reach a server.'
print 'Reason: ', e.reason
elif hasattr(e, 'code'):
print 'The server couldn\'t fulfill the request.'
print 'Error code: ', e.code
else:
print 'URL is good!'
--