Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 21 additions & 18 deletions streamrip/rip/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -457,24 +457,27 @@ async def latest_streamrip_version(verify_ssl: bool = True) -> tuple[str, str |
Returns:
A tuple of (version, release_notes)
"""
# Create connector with appropriate SSL settings
connector_kwargs = get_aiohttp_connector_kwargs(verify_ssl=verify_ssl)
connector = aiohttp.TCPConnector(**connector_kwargs)

async with aiohttp.ClientSession(connector=connector) as s:
async with s.get("https://pypi.org/pypi/streamrip/json") as resp:
data = await resp.json()
version = data["info"]["version"]

if version == __version__:
return version, None

async with s.get(
"https://api.github.com/repos/nathom/streamrip/releases/latest"
) as resp:
json = await resp.json()
notes = json["body"]
return version, notes
try:
connector_kwargs = get_aiohttp_connector_kwargs(verify_ssl=verify_ssl)
connector = aiohttp.TCPConnector(**connector_kwargs)

async with aiohttp.ClientSession(connector=connector) as s:
async with s.get("https://pypi.org/pypi/streamrip/json") as resp:
data = await resp.json(content_type=None)
version = data["info"]["version"]

if version == __version__:
return version, None

async with s.get(
"https://api.github.com/repos/nathom/streamrip/releases/latest"
) as resp:
gh = await resp.json(content_type=None)
notes = gh.get("body") if isinstance(gh, dict) else None
return version, notes
except Exception as e:
logger.debug("Could not check for updates: %s", e)
return __version__, None


if __name__ == "__main__":
Expand Down