MCPcopy Create free account
hub / github.com/Boris-code/feapder / open

Method open

feapder/network/response.py:383–393  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

381 self.close()
382
383 def open(self):
384 body = self.content
385 if b"<base" not in body:
386 # <head> 标签后插入一个<base href="url">标签
387 repl = fr'\1<base href="{self.url}">'
388 body = re.sub(rb"(<head(?:>|\s.*?>))", repl.encode("utf-8"), body)
389
390 fd, fname = tempfile.mkstemp(".html")
391 os.write(fd, body)
392 os.close(fd)
393 return webbrowser.open(f"file://{fname}")

Callers 5

RFunction · 0.80
docsify.min.jsFile · 0.80
get_conf_valueFunction · 0.80
intercept.jsFile · 0.80

Calls 2

encodeMethod · 0.80
closeMethod · 0.45

Tested by

no test coverage detected