resolve relative url on redirecting with Location
This commit is contained in:
parent
76eb3d22dc
commit
5efee60800
|
@ -1,7 +1,7 @@
|
||||||
import requests
|
import requests
|
||||||
from http.cookiejar import CookieJar
|
from http.cookiejar import CookieJar
|
||||||
|
|
||||||
from ..utils import get_user_agent
|
from ..utils import get_user_agent, absolute_url
|
||||||
|
|
||||||
|
|
||||||
class BaseFxcker:
|
class BaseFxcker:
|
||||||
|
@ -30,7 +30,8 @@ class BaseFxcker:
|
||||||
if follow_redirects is True and req.headers.get("Location"):
|
if follow_redirects is True and req.headers.get("Location"):
|
||||||
kwargs["data"] = None
|
kwargs["data"] = None
|
||||||
kwargs["headers"]["Referer"] = url
|
kwargs["headers"]["Referer"] = url
|
||||||
return self.request("GET", req.headers.get("Location"),
|
new_url = absolute_url(req.headers.get("Location"), url)
|
||||||
|
return self.request("GET", new_url,
|
||||||
resource=resource,
|
resource=resource,
|
||||||
follow_redirects=follow_redirects,
|
follow_redirects=follow_redirects,
|
||||||
**kwargs)
|
**kwargs)
|
||||||
|
|
Loading…
Reference in a new issue