redshift_credentials_dbname = config['AWS_REDSHIFT']['DBNAME'] redshift_credentials_host = config['AWS_REDSHIFT']['HOST'] redshift_credentials_port = config['AWS_REDSHIFT']['PORT'] redshift_credentials_user = config['AWS_REDSHIFT']['USER'] redshift_credentials_password = config['AWS_REDSHIFT']['PASSWORD'] user = config['LIME_CONFIG']['LIME_USER'] key = config['LIME_CONFIG']['LIME_KEY'] url = config['LIME_CONFIG']['LIME_API_URL'] sid = config['LIME_CONFIG']['LIME_SID_RETURN'] token = config['LIME_CONFIG']['LIME_TOKEN_BASE'] DATE_NOW = datetime.datetime.now().strftime('%Y%m%d') # Build the API lime = Api(url, user, key) export_res_token = lime.export_responses(sid=sid, status='', heading='', response='', fields='') OUTPUT_PATH = PATH + "/lime_export_{s}.txt".format(s=sid) with open(OUTPUT_PATH, 'w') as outfile: json.dump(export_res_token, outfile) d = pandas.read_json(OUTPUT_PATH) df = pandas.DataFrame() for row in d.index: data = pandas.DataFrame(
#!/usr/bin/python import base64 # to encode the surveys import config import json from limesurvey import Api # Authentication user = config.LIME_USER password = config.LIME_KEY url = config.LIME_API_URL # Build the API lime = Api(url, user, password) # SET TOKEN BASE and Survey sid = config.LIME_SID token = config.LIME_TOKEN_BASE data_resp = { 'token': 'test_token', '999729X44X2131111': "fabio_test_update_response" } resu = lime._add_response(sid, json.dumps(data_resp)) print("END EXAMPLE UPDATE_RESPONSE")
#!/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: