(self, site_url: str, output_dir: str, delay: float = 0.3,
dry_run: bool = False, url_filter: Optional[str] = None)
| 85 | |
| 86 | class WordPressMigrator: |
| 87 | def __init__(self, site_url: str, output_dir: str, delay: float = 0.3, |
| 88 | dry_run: bool = False, url_filter: Optional[str] = None): |
| 89 | self.site_url = site_url.rstrip("/") |
| 90 | self.output_dir = Path(output_dir) |
| 91 | self.delay = delay |
| 92 | self.dry_run = dry_run |
| 93 | self.url_filter = url_filter |
| 94 | self.session = requests.Session() |
| 95 | self.session.headers.update({ |
| 96 | "User-Agent": "docmcp-knowledge-migrator/1.0" |
| 97 | }) |
| 98 | self.h2t = html2text.HTML2Text() |
| 99 | self.h2t.ignore_links = False |
| 100 | self.h2t.ignore_images = False |
| 101 | self.h2t.body_width = 0 |
| 102 | self.h2t.protect_links = True |
| 103 | self.h2t.unicode_snob = True |
| 104 | self.stats: Dict[str, int] = { |
| 105 | "total": 0, "success": 0, "skipped": 0, "error": 0 |
| 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}" |
nothing calls this directly
no outgoing calls
no test coverage detected