HTTPError for status code 201

View: New views
5 Messages — Rating Filter:   Alert me  

HTTPError for status code 201

by Alexandru Popescu ☀ :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi again,

It looks like urllib2 is raising a HTTPError for responses with status
201 (created) which seems pretty weird. I have tested the behavior
with both Jython and CPython and it looks like both are behaving the
same way, so I was wondering if you can point me to some documentation
related to this behavior.

many thanks in advance,

./alex

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Jython-users mailing list
Jython-users@...
https://lists.sourceforge.net/lists/listinfo/jython-users

Re: HTTPError for status code 201

by Alexandru Popescu ☀ :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

2009/9/1 Alexandru Popescu ☀ <the.mindstorm.mailinglist@...>:

> Hi again,
>
> It looks like urllib2 is raising a HTTPError for responses with status
> 201 (created) which seems pretty weird. I have tested the behavior
> with both Jython and CPython and it looks like both are behaving the
> same way, so I was wondering if you can point me to some documentation
> related to this behavior.
>
> many thanks in advance,
>
> ./alex
>

I have found the bug reports related to this issue on CPython and it
looks like it was fixed only in 2.6. As far as I read the workaround
is the replace the default urllib2.HTTPErrorProcessor with a correct
one:

[bug code]
        if code not in (200, 206):
            response = self.parent.error(
                'http', request, response, code, msg, hdrs)
[/bug code]

[fix]
if not (200 <= code < 300):
  response = self.parent.error(
       'http', request, response, code, msg, hdrs)
[/fix]

./alex

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Jython-users mailing list
Jython-users@...
https://lists.sourceforge.net/lists/listinfo/jython-users

Re: HTTPError for status code 201

by Alan Kennedy-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

[Alexandru]
>> It looks like urllib2 is raising a HTTPError for responses with status
>> 201 (created) which seems pretty weird. I have tested the behavior
>> with both Jython and CPython and it looks like both are behaving the
>> same way, so I was wondering if you can point me to some documentation
>> related to this behavior.

[and]

> I have found the bug reports related to this issue on CPython and it
> looks like it was fixed only in 2.6. As far as I read the workaround
> is the replace the default urllib2.HTTPErrorProcessor with a correct
> one:

Well done for getting to the bottom of this.

It would be great if you could file a brief bug report on the jython
tracker, and reference the cpython bug in it.

Regards,

Alan.

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Jython-users mailing list
Jython-users@...
https://lists.sourceforge.net/lists/listinfo/jython-users

Re: HTTPError for status code 201

by Alexandru Popescu ☀ :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

2009/9/1 Alan Kennedy <jython-dev@...>:

> [Alexandru]
>>> It looks like urllib2 is raising a HTTPError for responses with status
>>> 201 (created) which seems pretty weird. I have tested the behavior
>>> with both Jython and CPython and it looks like both are behaving the
>>> same way, so I was wondering if you can point me to some documentation
>>> related to this behavior.
>
> [and]
>
>> I have found the bug reports related to this issue on CPython and it
>> looks like it was fixed only in 2.6. As far as I read the workaround
>> is the replace the default urllib2.HTTPErrorProcessor with a correct
>> one:
>
> Well done for getting to the bottom of this.
>
> It would be great if you could file a brief bug report on the jython
> tracker, and reference the cpython bug in it.
>
> Regards,
>
> Alan.
>

Alan,

I must confess that I haven't kept track of what I've found, but I can
definitely try to redo my investigation. On the other hand, I don't
have any idea where to file a bug :).

./alex

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Jython-users mailing list
Jython-users@...
https://lists.sourceforge.net/lists/listinfo/jython-users

Re: HTTPError for status code 201

by Alexandru Popescu ☀ :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

2009/9/4 Alexandru Popescu ☀ <the.mindstorm.mailinglist@...>:

> 2009/9/1 Alan Kennedy <jython-dev@...>:
>> [Alexandru]
>>>> It looks like urllib2 is raising a HTTPError for responses with status
>>>> 201 (created) which seems pretty weird. I have tested the behavior
>>>> with both Jython and CPython and it looks like both are behaving the
>>>> same way, so I was wondering if you can point me to some documentation
>>>> related to this behavior.
>>
>> [and]
>>
>>> I have found the bug reports related to this issue on CPython and it
>>> looks like it was fixed only in 2.6. As far as I read the workaround
>>> is the replace the default urllib2.HTTPErrorProcessor with a correct
>>> one:
>>
>> Well done for getting to the bottom of this.
>>
>> It would be great if you could file a brief bug report on the jython
>> tracker, and reference the cpython bug in it.
>>
>> Regards,
>>
>> Alan.
>>
>
> Alan,
>
> I must confess that I haven't kept track of what I've found, but I can
> definitely try to redo my investigation.

The only thing I do remember off hand is a peculiar thing: the
behavior for 206 status code has been fixed prior to 2.6, but not for
other status codes in the 200 - 300 range.

./alex

>
> ./alex
>

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Jython-users mailing list
Jython-users@...
https://lists.sourceforge.net/lists/listinfo/jython-users