On Wednesday, October 22, 2014 5:07:00 PM UTC+5:30, Diya Rai wrote:
> Hai,
> 
>   Could anyone please help me to resolve 403 forbidden error while logging 
> into an application.
> 
> Following is the error details:
> 
> Traceback (most recent call last):
>   File "./example6.py", line 18, in <module>
>     response = urllib2.urlopen(req)
>   File "/usr/lib/python2.7/urllib2.py", line 126, in urlopen
>     return _opener.open(url, data, timeout)
>   File "/usr/lib/python2.7/urllib2.py", line 406, in open
>     response = meth(req, response)
>   File "/usr/lib/python2.7/urllib2.py", line 519, in http_response
>     'http', request, response, code, msg, hdrs)
>   File "/usr/lib/python2.7/urllib2.py", line 444, in error
>     return self._call_chain(*args)
>   File "/usr/lib/python2.7/urllib2.py", line 378, in _call_chain
>     result = func(*args)
>   File "/usr/lib/python2.7/urllib2.py", line 527, in http_error_default
>     raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
> urllib2.HTTPError: HTTP Error 403: FORBIDDEN
> 
> 
> Sorry if the question is not relevant as im new to python.
> 
> 
> Regards,
> Diya

Thanks Chris Angelico and Dennis Lee Bieber for replying.
Username and password is correct.
Its a simple login script.

import urllib
import httplib2

http = httplib2.Http()

url = 'http://localhost/login_ajax'   
body = {'email': 'x...@google.com', 
        'password': '*******'}
headers = {'Content-type': 'application/x-www-form-urlencoded'}
response, content = http.request(url, 'POST', headers=headers, 
body=urllib.urlencode(body))
print response

This is the part of the code which im trying to execute. We are trying to load 
test a web application through python script, currently checking the login part.

Thanks in advance,
Diya
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to