Exemplo n.º 1
0
    total = info.get(u"total")
    downloaded = info.get(u"downloaded")
    status = info.get(u"status")
    print downloaded, total, status


# Another callback
def log_status_info(info):
    total = info.get(u"total")
    downloaded = info.get(u"downloaded")
    status = info.get(u"status")
    log.info("{} of {} downloaded - {}".format(downloaded, total, status))


# Initialize the client
client = Client(ClientConfig())
client.refresh()

# Or initialize & refresh in one step
client = Client(ClientConfig(), refresh=True, callback=print_status_info)


# Add as many callbacks as you like
client.add_callback(log_status_info)

# First we check for updates.
# If an update is found an update object will be returned
# If no updates are available, None will be returned
zip_update = client.update_check("7-zip", "0.0.1", channel="beta")

# Example of downloading on the main thread
Exemplo n.º 2
0
    total = info.get(u'total')
    downloaded = info.get(u'downloaded')
    status = info.get(u'status')
    print downloaded, total, status


# Another callback
def log_status_info(info):
    total = info.get(u'total')
    downloaded = info.get(u'downloaded')
    status = info.get(u'status')
    log.info("{} of {} downloaded - {}".format(downloaded, total, status))


# Initialize the client
client = Client(ClientConfig())
client.refresh()

# Or initialize & refresh in one step
client = Client(ClientConfig(), refresh=True, callback=print_status_info)

# Add as many callbacks as you like
client.add_callback(log_status_info)

# First we check for updates.
# If an update is found an update object will be returned
# If no updates are available, None will be returned
zip_update = client.update_check('7-zip', '0.0.1')

# Example of downloading on the main thread
if zip_update is not None:
Exemplo n.º 3
0
    total = info.get(u'total')
    downloaded = info.get(u'downloaded')
    status = info.get(u'status')
    print downloaded, total, status


# Another callback
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)


# Initialize the client
client = Client(ClientConfig())
client.refresh()

# Or initialize & refresh in one step
client = Client(ClientConfig(), refresh=True,
                progress_hooks=[print_status_info])


# Add as many callbacks as you like
client.add_progress_hook(log_status_info)

# First we check for updates.
# If an update is found an update object will be returned
# If no updates are available, None will be returned
zip_update = client.update_check('7-zip', '0.0.1', channel='beta')
Exemplo n.º 4
0
    total = info.get(u'total')
    downloaded = info.get(u'downloaded')
    status = info.get(u'status')
    print downloaded, total, status


# Another callback
def log_status_info(info):
    total = info.get(u'total')
    downloaded = info.get(u'downloaded')
    status = info.get(u'status')
    log.info("{} of {} downloaded - {}".format(downloaded, total, status))


# Initialize the client
client = Client(ClientConfig())
client.refresh()

# Or initialize & refresh in one step
client = Client(ClientConfig(), refresh=True, callback=print_status_info)


# Add as many callbacks as you like
client.add_callback(log_status_info)

# First we check for updates.
# If an update is found an update object will be returned
# If no updates are available, None will be returned
zip_update = client.update_check('7-zip', '0.0.1')

# Example of downloading on the main thread