MCPcopy Create free account
hub / github.com/Freedium-cfd/web / resolve

Method resolve

medium-parser/medium_parser/core.py:69–88  ·  view source on GitHub ↗
(self, unknown: str)

Source from the content-addressed store, hash-verified

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)

Callers 8

render_medium_post_linkFunction · 0.45
aaFunction · 0.45
wxFunction · 0.45
asyncMethod · 0.45
c2Function · 0.45
SgFunction · 0.45
kyFunction · 0.45

Calls 4

resolve_urlMethod · 0.95
extract_hex_stringFunction · 0.85
errorMethod · 0.80

Tested by

no test coverage detected