(self, endpoint: str, params: Optional[dict] = None)
| 78 | self._category_cache: Dict[int, str] = {} |
| 79 | |
| 80 | def api_get(self, endpoint: str, params: Optional[dict] = None) -> Optional[object]: |
| 81 | url = f"{self.site_url}/wp-json/wp/v2/{endpoint}" |
| 82 | try: |
| 83 | resp = self.session.get(url, params=params, timeout=30) |
| 84 | if resp.status_code == 400: |
| 85 | return None |
| 86 | resp.raise_for_status() |
| 87 | return resp.json() |
| 88 | except requests.RequestException as e: |
| 89 | print(f" ERROR fetching {url}: {e}") |
| 90 | return None |
| 91 | |
| 92 | def get_all_posts(self) -> List[dict]: |
| 93 | """Fetch all published posts with pagination.""" |
no test coverage detected