mirror of
https://github.com/HIllya51/LunaTranslator.git
synced 2024-12-28 08:04:13 +08:00
redirect
This commit is contained in:
parent
682548b566
commit
79e37c5342
@ -205,6 +205,14 @@ class Sessionbase:
|
|||||||
|
|
||||||
_= self.request_impl(method,scheme,server,port,param,url,headers,cookies,dataptr,datalen,proxy,stream,verify)
|
_= self.request_impl(method,scheme,server,port,param,url,headers,cookies,dataptr,datalen,proxy,stream,verify)
|
||||||
|
|
||||||
|
if _.status_code==301:
|
||||||
|
location=_.headers['Location']
|
||||||
|
if location.startswith('/'):#vndb
|
||||||
|
url=url=scheme+'://'+server+location
|
||||||
|
param=location
|
||||||
|
_= self.request_impl(method,scheme,server,port,param,url,headers,cookies,dataptr,datalen,proxy,stream,verify)
|
||||||
|
else:
|
||||||
|
raise Exception('301 redirect '+location)
|
||||||
return _
|
return _
|
||||||
def get(self, url, **kwargs):
|
def get(self, url, **kwargs):
|
||||||
return self.request("GET", url, **kwargs)
|
return self.request("GET", url, **kwargs)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user