MCPcopy Create free account
hub / github.com/apify/crawlee-python / serve

Method serve

tests/unit/server.py:491–504  ·  view source on GitHub ↗

Run the server and set up restart capability. Args: sockets: Optional list of sockets to bind to.

(self, sockets: list[socket] | None = None)

Source from the content-addressed store, hash-verified

489 return URL(f'{protocol}://{self.config.host}:{self.config.port}/')
490
491 async def serve(self, sockets: list[socket] | None = None) -> None:
492 """Run the server and set up restart capability.
493
494 Args:
495 sockets: Optional list of sockets to bind to.
496 """
497 self.restart_requested = asyncio.Event()
498
499 loop = asyncio.get_event_loop()
500 tasks = {
501 loop.create_task(super().serve(sockets=sockets)),
502 loop.create_task(self.watch_restarts()),
503 }
504 await asyncio.wait(tasks)
505
506 async def restart(self) -> None:
507 """Request server restart and wait for it to complete.

Callers 1

runMethod · 0.95

Calls 1

watch_restartsMethod · 0.95

Tested by

no test coverage detected