You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
blivechat/update.py

27 lines
844 B
Python

# -*- coding: utf-8 -*-
import asyncio
import aiohttp
VERSION = 'v1.5.0'
def check_update():
asyncio.ensure_future(_do_check_update())
async def _do_check_update():
5 years ago
try:
async with aiohttp.ClientSession() as session:
async with session.get('https://api.github.com/repos/xfgryujk/blivechat/releases/latest') as r:
data = await r.json()
if data['name'] != VERSION:
print('---------------------------------------------')
5 years ago
print('New version available:', data['name'])
print(data['body'])
print('Download:', data['html_url'])
print('---------------------------------------------')
5 years ago
except aiohttp.ClientConnectionError:
print('Failed to check update: connection failed')