| 106 | } |
| 107 | |
| 108 | def api_get(self, endpoint: str, params: Optional[dict] = None) -> Optional[object]: |
| 109 | url = f"{self.site_url}/wp-json/wp/v2/{endpoint}" |
| 110 | try: |
| 111 | resp = self.session.get(url, params=params, timeout=30) |
| 112 | if resp.status_code == 400: |
| 113 | return None |
| 114 | resp.raise_for_status() |
| 115 | return resp.json() |
| 116 | except requests.RequestException as e: |
| 117 | print(f" ERROR fetching {url}: {e}") |
| 118 | return None |
| 119 | |
| 120 | def get_all_docs(self) -> List[dict]: |
| 121 | """Fetch all published docs with pagination.""" |