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

Class RequestInterceptor

QWebEngineView/BlockRequest.py:25–32  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

23
24
25class RequestInterceptor(QWebEngineUrlRequestInterceptor):
26
27 def interceptRequest(self, info):
28 url = info.requestUrl().toString()
29 if url.find('pos.baidu.com') > -1 and url.find('ltu=') > -1:
30 # 拦截百度联盟的广告
31 print('block:', url)
32 info.block(True)
33
34
35class Window(QWebEngineView):

Callers 1

__init__Method · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected