Your request url is "RESTRICTED".
If you try this code it will tell you:
import urllib2
theurl = 'https://updates.opendns.com/nic/update?hostname='
req = urllib2.Request(theurl)
try:
handle = urllib2.urlopen(req)
except IOError, e:
if hasattr(e, 'code'):
if e.code != 401:
print 'We got another error'
print e.code
else:
print e.headers
print e.headers['www-authenticate']
You should add authorization headers. For more details have a look into: http://www.voidspace.org.uk/python/articles/authentication.shtml
And another code example is: http://code.activestate.com/recipes/305288-http-basic-authentication/
If you wish to send POST request , try it:
import urllib
import urllib2
username = "username"
password = "password"
url = 'http://url.com/'
values = { 'username': username,'password': password }
data = urllib.urlencode(values)
req = urllib2.Request(url, data)
response = urllib2.urlopen(req)
result = response.read()
print result
Note: this is just an example of how to send POST request to URL.