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

Method __init__

scripts/migrate_posts.py:59–78  ·  view source on GitHub ↗
(self, site_url: str, output_dir: str, delay: float = 0.3,
                 dry_run: bool = False)

Source from the content-addressed store, hash-verified

57
58class PostsMigrator:
59 def __init__(self, site_url: str, output_dir: str, delay: float = 0.3,
60 dry_run: bool = False):
61 self.site_url = site_url.rstrip("/")
62 self.output_dir = Path(output_dir)
63 self.delay = delay
64 self.dry_run = dry_run
65 self.session = requests.Session()
66 self.session.headers.update({
67 "User-Agent": "docmcp-knowledge-migrator/1.0"
68 })
69 self.h2t = html2text.HTML2Text()
70 self.h2t.ignore_links = False
71 self.h2t.ignore_images = False
72 self.h2t.body_width = 0
73 self.h2t.protect_links = True
74 self.h2t.unicode_snob = True
75 self.stats: Dict[str, int] = {
76 "total": 0, "success": 0, "skipped": 0, "error": 0
77 }
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}"

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected