Fix bugs, add update system + tests + fix deployment/build system
This commit is contained in:
@@ -6,19 +6,23 @@ from urllib.error import HTTPError
|
||||
def fetch_version(url: str) -> str:
|
||||
"""
|
||||
Retrieve the latest webpicdownloader version available.
|
||||
This method, only accept 200 http response.
|
||||
|
||||
* :url: -> Url of the "VERSION" file on the repository.
|
||||
* RETURN -> the latests 'VERSION' file content.
|
||||
* THROWABLE -> can raise HTTP or URL error see urllib doc.
|
||||
"""
|
||||
headers = {'User-Agent': "Mozilla/5.0 (Windows NT 11.0; Win64; x64) AppleWebKit/605.1.15 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/604.1"}
|
||||
request = http.Request(url=url, headers=headers, method='GET')
|
||||
request = http.Request(
|
||||
url=url,
|
||||
headers={'User-Agent': "Mozilla/5.0 (Windows NT 11.0; Win64; x64) AppleWebKit/605.1.15 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/604.1"},
|
||||
method='GET'
|
||||
)
|
||||
response = http.urlopen(request)
|
||||
if response.getcode() != 200:
|
||||
raise HTTPError("Bad response returned by server")
|
||||
return response.read().decode('utf-8')
|
||||
|
||||
def is_new_version_available(version_current: str, version_url: str, version_pattern: Pattern) -> bool:
|
||||
def check_for_update(version_current: str, version_url: str, version_pattern: Pattern) -> bool:
|
||||
"""
|
||||
Verify if a new version is available.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user