How to use the appier.get function in appier

To help you get started, we’ve selected a few appier examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github hivesolutions / appier / examples / http / download.py View on Github external
except: pass

def copy(input, name, buffer_size = 16384):
    output = open(name, "wb")
    try:
        while True:
            data = input.read(buffer_size)
            if not data: break
            output.write(data)
    finally:
        output.close()

def is_tty():
    return hasattr(sys.stdout, "isatty") and sys.stdout.isatty()

contents, _response = appier.get(
    url,
    handle = True,
    redirect = True,
    retry = 0,
    use_file = True,
    callback_headers = callback_headers,
    callback_data = callback_data,
    callback_result = callback_result
)

try: copy(contents, name)
finally: contents.close()
github hivesolutions / appier / examples / http / http_sync.py View on Github external
__revision__ = "$LastChangedRevision$"
""" The revision number of the module """

__date__ = "$LastChangedDate$"
""" The last change date of the module """

__copyright__ = "Copyright (c) 2008-2018 Hive Solutions Lda."
""" The copyright for the module """

__license__ = "Apache License, Version 2.0"
""" The license for the module """

import appier

_contents, response = appier.get("https://www.flickr.com/", handle = True)
print(response.getcode())
print(response.read())
github hivesolutions / appier / examples / http / http_async.py View on Github external
__license__ = "Apache License, Version 2.0"
""" The license for the module """

import appier

def callback(result, response):
    if response:
        print(response.getcode())
        print(response.read())
    else:
        print("Problem in connection")

    loop.stop()

loop, protocol = appier.get(
    "https://www.flickr.com/",
    handle = True,
    asynchronous = True,
    callback = callback
)

loop.run_forever()
loop.close()