MCPcopy
hub / github.com/scrapy/scrapy / Root

Class Root

scrapy/utils/benchserver.py:9–27  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7
8
9class Root(Resource):
10 isLeaf = True
11
12 def getChild(self, path: str, request: Request) -> Resource:
13 return self
14
15 def render(self, request: Request) -> bytes:
16 total = _getarg(request, b"total", 100, int)
17 show = _getarg(request, b"show", 10, int)
18 nlist = [random.randint(1, total) for _ in range(show)] # noqa: S311
19 request.write(b"<html><head></head><body>")
20 assert request.args is not None
21 args = request.args.copy()
22 for nl in nlist:
23 args["n"] = nl
24 argstr = urlencode(args, doseq=True)
25 request.write(f"<a href='/follow?{argstr}'>follow {nl}</a><br>".encode())
26 request.write(b"</body></html>")
27 return b""
28
29
30def _getarg(

Callers 1

benchserver.pyFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…