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

Function resolve_medium_short_link

medium-parser/medium_parser/utils.py:240–255  ·  view source on GitHub ↗
(short_url_id: str, timeout: int = 5)

Source from the content-addressed store, hash-verified

238
239
240async def resolve_medium_short_link(short_url_id: str, timeout: int = 5) -> str:
241 async with aiohttp.ClientSession() as session:
242 retry_client = RetryClient(
243 client_session=session, raise_for_status=False, retry_options=retry_options
244 )
245 request = await retry_client.get(
246 f"https://rsci.app.link/{short_url_id}",
247 timeout=timeout,
248 headers={
249 "User-Agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36"
250 },
251 allow_redirects=False,
252 )
253 post_url = request.headers["Location"]
254
255 return post_url
256
257
258@alru_cache(maxsize=500)

Callers 1

resolve_medium_urlFunction · 0.85

Calls 1

getMethod · 0.45

Tested by

no test coverage detected