Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #79764
| Newsgroups | comp.lang.python |
|---|---|
| Date | 2014-10-26 22:12 -0700 |
| References | <82d4292e-10de-4d47-882e-bab75777fbfe@googlegroups.com> |
| Message-ID | <04b6b33f-885e-4e4a-b458-b258b34fbb90@googlegroups.com> (permalink) |
| Subject | Re: 403 forbidden error |
| From | Diya Rai <diyaraik@gmail.com> |
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': 'xyz@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
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
403 forbidden error diyaraik@gmail.com - 2014-10-22 04:36 -0700
Re: 403 forbidden error Chris Angelico <rosuav@gmail.com> - 2014-10-22 23:43 +1100
Re: 403 forbidden error Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2014-10-22 08:50 -0400
Re: 403 forbidden error Diya Rai <diyaraik@gmail.com> - 2014-10-26 22:12 -0700
Re: 403 forbidden error Chris Angelico <rosuav@gmail.com> - 2014-10-27 16:34 +1100
Re: 403 forbidden error Diya Rai <diyaraik@gmail.com> - 2014-10-26 22:56 -0700
csiph-web