(short_url_id: str, timeout: int = 5)
| 238 | |
| 239 | |
| 240 | async 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) |
no test coverage detected