Adds handlers from a different Hug API to this one - to create a single API
(self, api, route="", base_url="", http=True, cli=True, **kwargs)
| 598 | return self._context |
| 599 | |
| 600 | def extend(self, api, route="", base_url="", http=True, cli=True, **kwargs): |
| 601 | """Adds handlers from a different Hug API to this one - to create a single API""" |
| 602 | api = API(api) |
| 603 | |
| 604 | if http and hasattr(api, "_http"): |
| 605 | self.http.extend(api.http, route, base_url, **kwargs) |
| 606 | |
| 607 | if cli and hasattr(api, "_cli"): |
| 608 | self.cli.extend(api.cli, **kwargs) |
| 609 | |
| 610 | for directive in getattr(api, "_directives", {}).values(): |
| 611 | self.add_directive(directive) |
| 612 | |
| 613 | for startup_handler in api.startup_handlers or (): |
| 614 | self.add_startup_handler(startup_handler) |
| 615 | |
| 616 | def add_startup_handler(self, handler): |
| 617 | """Adds a startup handler to the hug api""" |