Parse and validate package index JSON
(self, json_str: str)
| 441 | self.timeout = timeout |
| 442 | |
| 443 | def parse_package_index(self, json_str: str) -> PackageIndex: |
| 444 | """Parse and validate package index JSON""" |
| 445 | try: |
| 446 | raw_data = json.loads(json_str) |
| 447 | return PackageIndex(**raw_data) |
| 448 | except ValidationError as e: |
| 449 | raise PackageParsingError(f"Invalid package index format: {e}") |
| 450 | except json.JSONDecodeError as e: |
| 451 | raise PackageParsingError(f"Invalid JSON format: {e}") |
| 452 | |
| 453 | def parse_from_url(self, url: str) -> PackageIndex: |
| 454 | """Fetch and parse package index from URL with validation""" |