-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathupdate.py
More file actions
29 lines (22 loc) · 780 Bytes
/
update.py
File metadata and controls
29 lines (22 loc) · 780 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import requests
import feedparser
# URL of the releases.atom feed for the repository
repo_url = "https://github.com/bubfusion/Vatsim-Discord-RPC/releases.atom"
def check_for_update(version):
# Fetch the releases.atom feed
response = requests.get(repo_url)
if response.status_code == 200:
# Parse the Atom feed
feed = feedparser.parse(response.content)
# Get the latest release entry
latest_release = feed.entries[0]
# Extract the ID of the latest release
latest_release_id = latest_release.id
latest_release_version = latest_release_id.split("/")[-1]
# Compare the IDs
if version == latest_release_version:
return True
else:
return False
else:
return None