blivechat/update.py

19 lines
606 B
Python
Raw Normal View History

2019-09-16 20:48:03 +08:00
# -*- coding: utf-8 -*-
import aiohttp
2019-11-28 22:25:50 +08:00
VERSION = 'v1.2.3'
2019-09-16 20:48:03 +08:00
async def check_update():
2019-11-29 23:48:43 +08:00
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('New version available:', data['name'])
print(data['body'])
print('Download:', data['html_url'])
except aiohttp.ClientConnectionError:
print('Failed to check update: connection failed')