Ghost.py/Qtwebkit redirect problem + solution

Contents

I'm using ghost.py and qtwebkit which seem to have a problem with the 3xx HTTP-Status codes. It doesn't follow the "Location" header. In this post I explain my hackfix so that this works again.

Bug description

I use PyQt 4.9.6-r2 from the gentoo repository. And the Ghost.py from 4th May. When using ghost.load("http:/..") on a webpage which sends a 3xx status code with a location back, it won't automatically follow.

Update 18.6.2013: seems to work now. But I don't know what I've changed.

Fix

I think the quality of my fix is quite bad, but works and that is all I need :) [gist]https://gist.github.com/balrok/5520379[/gist] So I looked at where Ghost.py added the decorator @can_load_page and copied the methods to add my decorator.

My decorator works recursively, but doesn't count the number of redirects.. Also it will break if the Server doesn't send the "Location" in it's header.. but you may get the idea.. and I assume that this bug will be fixed soon.

Commentaires: