(self, unknown: str)
| 67 | self.medium_api: MediumApi = medium_api |
| 68 | |
| 69 | async def resolve(self, unknown: str) -> str: |
| 70 | logger.debug(f"We got some unknown data: {unknown=}. Trying resolve them...///") |
| 71 | post_id = None |
| 72 | |
| 73 | try: |
| 74 | logger.debug("...maybe it's URL. Let's checkout...") |
| 75 | post_id = await self.resolve_url(unknown) |
| 76 | except Exception as e: |
| 77 | logger.exception(e) |
| 78 | logger.error(f"Error while resolving URL: {e}") |
| 79 | |
| 80 | if is_has_valid_medium_post_id(unknown): |
| 81 | logger.debug("Seems like it's valid post_id") |
| 82 | return extract_hex_string(unknown) |
| 83 | |
| 84 | logger.error(f"Unknown data: {unknown}") |
| 85 | |
| 86 | raise e |
| 87 | |
| 88 | return post_id |
| 89 | |
| 90 | async def resolve_url(self, url: str) -> str: |
| 91 | sanitized_url = correct_url(url) |
no test coverage detected