This repository has been archived by the owner on Feb 2, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #80 from LeagueOfPoro/version-manager
Check for updates
- Loading branch information
Showing
4 changed files
with
98 additions
and
96 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import requests as req | ||
|
||
class VersionManager: | ||
|
||
@staticmethod | ||
def getLatestTag(): | ||
latestTagResponse = req.get("https://api.github.com/repos/LeagueOfPoro/EsportsCapsuleFarmer/releases/latest") | ||
if 'application/json' in latestTagResponse.headers.get('Content-Type', ''): | ||
latestTagJson = latestTagResponse.json() | ||
if "tag_name" in latestTagJson: | ||
return float(latestTagJson["tag_name"][1:]) | ||
return 0.0 | ||
@staticmethod | ||
def isLatestVersion(currentVersion): | ||
return currentVersion >= VersionManager.getLatestTag() | ||
|
||
print(VersionManager.isLatestVersion(3.8)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.