An object containing page data.
| 84 | |
| 85 | |
| 86 | class PageData(Base): |
| 87 | """An object containing page data.""" |
| 88 | |
| 89 | host: str = "" # repeated with self.headers.origin (remove or keep the duplicate?) |
| 90 | path: str = "" |
| 91 | raw_path: str = "" |
| 92 | full_path: str = "" |
| 93 | full_raw_path: str = "" |
| 94 | params: dict = {} |
| 95 | |
| 96 | def __init__(self, router_data: Optional[dict] = None): |
| 97 | """Initalize the PageData object based on router_data. |
| 98 | |
| 99 | Args: |
| 100 | router_data: the router_data dict. |
| 101 | """ |
| 102 | super().__init__() |
| 103 | if router_data: |
| 104 | self.host = router_data.get(constants.RouteVar.HEADERS, {}).get("origin") |
| 105 | self.path = router_data.get(constants.RouteVar.PATH, "") |
| 106 | self.raw_path = router_data.get(constants.RouteVar.ORIGIN, "") |
| 107 | self.full_path = f"{self.host}{self.path}" |
| 108 | self.full_raw_path = f"{self.host}{self.raw_path}" |
| 109 | self.params = router_data.get(constants.RouteVar.QUERY, {}) |
| 110 | |
| 111 | |
| 112 | class SessionData(Base): |
no outgoing calls
no test coverage detected