예제 #1
0
url = config.LIME_API_URL

# Build the API
lime = Api(url, user, key)

# SET TOKEN BASE and Survey
sid = config.LIME_SID
token = config.LIME_TOKEN_BASE

# GET data - token
export_res_token = lime.export_responses_by_token(sid, token)

# Insert in db
export_res = export_res_token

## Add Response
response_to_add = {}

# export_res export_res = lime.export_responses_by_token('999729', 'qdgb2bkiqgqwtvu')
if export_res is not None:
    decoded_string = base64.b64decode(export_res)
    with open("Output.json", "w") as text_file:
        text_file.write(decoded_string)

# get json object of surveys on the lime url
survey_res = lime.list_surveys(user)

# one can simply import json_normalize from pandas to normalize the json object
# from pandas.io.json import json_normalize
# survey_res_list = json_normalize(survey_res)
예제 #2
0
#!/usr/bin/python

from limesurvey import Api
import base64  # para encodear la subida de surveys

# demo de limesurvey
usuario = 'admin'
clave = 'test'
url = 'http://demo.limesurvey.org/index.php?r=admin/remotecontrol'

lime = Api(url, usuario, clave)

for e in lime.list_surveys():

    propiedades = lime.get_survey_properties(e[0], settings='["active"]')

    if propiedades['active'] == 'Y':
        print "La encuesta %s esta activa" % e[0]
        summary = lime.get_summary(e[0])

        if summary['full_responses'] != '0':
            print summary
            datos = lime.export_responses(e[0])

            if datos is not None:
                decoded_string = base64.b64decode(datos)
                print decoded_string

                break

    else: