MCPcopy Create free account
hub / github.com/RASAAS/docmcp-knowledge / api_get

Method api_get

scripts/migrate_posts.py:80–90  ·  view source on GitHub ↗
(self, endpoint: str, params: Optional[dict] = None)

Source from the content-addressed store, hash-verified

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."""

Callers 2

get_all_postsMethod · 0.95
get_category_slugMethod · 0.95

Calls 1

getMethod · 0.80

Tested by

no test coverage detected