(url, token, action=PULL, fname="")
return content
Send
Send
Send
def api_response(url, token, action=PULL, fname=""):
    """
    Send
    """

    params = {"token": token}

    # Push conf as a file to remote host.
    if action == PUSH:
        # Pass conf as a file.
        stream = open(fname, "r")
        files = {"data": stream}
        response = requests.post(url, params=params, files=files)
    # Pull data from remote host.
    else:
        response = requests.get(url, params=params)

    content = response.content.decode()
    return content
def api_response ( url , token , action = PULL , fname = "" ) : params = { "token" : token } # Push conf as a file to remote host. if action == PUSH : # Pass conf as a file. stream = open ( fname , "r" ) files = { "data" : stream } response = requests . post ( url , params = params , files = files ) # Pull data from remote host. else : response = requests . get ( url , params = params ) content = response . content . decode ( ) return content