MCPcopy Create free account
hub / github.com/PyQt5/PyQt / RequestInterceptor

Class RequestInterceptor

QWebEngineView/GetRequestInfo.py:73–84  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

71
72# 把所有请求重定向到myurl
73class RequestInterceptor(QWebEngineUrlRequestInterceptor):
74
75 def interceptRequest(self, info):
76 url = info.requestUrl()
77 if url.scheme() == 'http':
78 # 重定向
79 url.setScheme('myurl')
80 info.redirect(url)
81 elif url.scheme() == 'https':
82 # 重定向
83 url.setScheme('myurls')
84 info.redirect(url)
85
86
87class Window(QWebEngineView):

Callers 1

__init__Method · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected