Python 2.7.3 (default, Mar 13 2014, 11:03:55)
[GCC 4.7.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import urllib2
>>> req = urllib2.Request("http:///wp-login.php")
>>> website='kseek.com.my'
>>> req = urllib2.Request("http://"+website+"/wp-login.php")
>>> req.add_header('User-agent', 'Mozilla 5.10')
>>> req.add_header('Referer', 'http://'+website)
>>> data = urllib2.urlopen(req, timeout=6).read()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/urllib2.py", line 127, in urlopen
return _opener.open(url, data, timeout)
File "/usr/lib/python2.7/urllib2.py", line 407, in open
response = meth(req, response)
File "/usr/lib/python2.7/urllib2.py", line 520, in http_response
'http', request, response, code, msg, hdrs)
File "/usr/lib/python2.7/urllib2.py", line 445, in error
return self._call_chain(*args)
File "/usr/lib/python2.7/urllib2.py", line 379, in _call_chain
result = func(*args)
File "/usr/lib/python2.7/urllib2.py", line 528, in http_error_default
raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
urllib2.HTTPError: HTTP Error 406: Not Acceptable
>>> req = urllib2.Request("http://"+website+"/")
>>> req.add_header('User-agent', 'Mozilla 5.10')
>>> req.add_header('Referer', 'http://'+website)
>>> data = urllib2.urlopen(req, timeout=6).read()
>>>
As you notice, When requesting /wp-login.php which i can reach manually via browser ow even curl I get 406 error while with the same method requesting /index.php , work without problem Any help?