from pyupdater.client import Client
import logging
from client_config import ClientConfig
#from fileserver import RunFileServer
logging.basicConfig(level=logging.DEBUG)
APP_NAME = 'updaterapp'
APP_VERSION = '1.0.0'
import http.client as http_client
http_client.HTTPConnection.debuglevel = 1
#RunFileServer(3000)
def print_status_info(info):
total = info.get(u'total')
downloaded = info.get(u'downloaded')
status = info.get(u'status')
log.debug(downloaded, total, status)
def progress(data):
print('Time remaining'.format(data['time']))
def log_progress(data):
log.debug('Total file size %s', data['total'])
def log_status_info(info):
total = info.get(u'total')
downloaded = info.get(u'downloaded')
status = info.get(u'status')
log.info("%s of %s downloaded - %s", downloaded, total, status)
# Or you can add them later.
#client = Client(ClientConfig(),refersh=True) 'Content-Encoding': 'gzip'
# 'Content-Encoding': 'gzip,rar,zip,utf-8','Content-Decoding': 'gzip,rar,zip,utf-8',
#,'Accept-Decoding':'gzip,zip,rar,utf-8',
#'Content-Length':'123'
headers = {'Accept-Encoding': 'gzip'}
client = Client(ClientConfig(),headers=headers,progress_hooks=[print_status_info])
#client.platform = "win"
client.refresh()
client.add_progress_hook(log_status_info)
#client.VerifyKey()
#print(client.verifykey)
#client.add_progress_hook(log_progress)
#client.add_progress_hook(progress)
#client.platform = "win"
app_update = client.update_check(APP_NAME,APP_VERSION)
if app_update is not None:
app_update.download()
else:
print("Version 1")
#if app_update.is_downloaded():
#app_update.extract()
#app_update.update_folder
Error: DEBUG:dsdev_utils.paths:Moving back to Directory --> C:\Users\asad.elahi\Desktop\work\updaterapp\v1 Traceback (most recent call last): File "C:\Users\asad.elahi\Desktop\work\updaterapp\v1\main.py", line 37, in client.refresh() File "C:\Users\asad.elahi\AppData\Local\Programs\Python\Python39\lib\site-packages\pyupdater\client_init_.py", line 217, in refresh self.get_signing_key() File "C:\Users\asad.elahi\AppData\Local\Programs\Python\Python39\lib\site-packages\pyupdater\client_init.py", line 368, in get_signing_key key_data = json.loads(key_data_str.decode("utf-8")) File "C:\Users\asad.elahi\AppData\Local\Programs\Python\Python39\lib\json_init.py", line 346, in loads return _default_decoder.decode(s) File "C:\Users\asad.elahi\AppData\Local\Programs\Python\Python39\lib\json\decoder.py", line 337, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "C:\Users\asad.elahi\AppData\Local\Programs\Python\Python39\lib\json\decoder.py", line 355, in raw_decode raise JSONDecodeError("Expecting value", s, err.value) from None json.decoder.JSONDecodeError: Expecting value: line 7 column 1 (char 6)