Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #79764

Re: 403 forbidden error

X-Received by 10.42.62.81 with SMTP id x17mr24592370ich.10.1414386730553; Sun, 26 Oct 2014 22:12:10 -0700 (PDT)
X-Received by 10.50.141.138 with SMTP id ro10mr189794igb.16.1414386730361; Sun, 26 Oct 2014 22:12:10 -0700 (PDT)
Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!uq10no18307977igb.0!news-out.google.com!rp1ni3521igb.0!nntp.google.com!r10no456184igi.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail
Newsgroups comp.lang.python
Date Sun, 26 Oct 2014 22:12:09 -0700 (PDT)
In-Reply-To <82d4292e-10de-4d47-882e-bab75777fbfe@googlegroups.com>
Complaints-To groups-abuse@google.com
Injection-Info glegroupsg2000goo.googlegroups.com; posting-host=103.21.126.78; posting-account=T6S84AoAAAD2bjgt90nFvo_smP1SfX8Z
NNTP-Posting-Host 103.21.126.78
References <82d4292e-10de-4d47-882e-bab75777fbfe@googlegroups.com>
User-Agent G2/1.0
MIME-Version 1.0
Message-ID <04b6b33f-885e-4e4a-b458-b258b34fbb90@googlegroups.com> (permalink)
Subject Re: 403 forbidden error
From Diya Rai <diyaraik@gmail.com>
Injection-Date Mon, 27 Oct 2014 05:12:10 +0000
Content-Type text/plain; charset=ISO-8859-1
Xref csiph.com comp.lang.python:79764

Show key headers only | View raw


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


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