Exemplo n.º 1
0
import urllib
import config
import quapi
import parsers
import helpers
import filemanager
import os
from datetime import datetime, timedelta
#load config.
config.init()
curdir = os.path.dirname(__file__)
#read old validation file, exit if it's bad
valpath = os.path.join(curdir, 'validation.txt')
validation = filemanager.readcsv(valpath)
if validation[0][0] != 'GOOD':
   print(validation[0][0])
   print('Something went wrong at' + str(datetime.now()) + ', Stopping')
   exit()

validation[0][0] = 'BAD'
filemanager.writecsv(validation, valpath)

#read old csv to get data.
csvpath = os.path.join(curdir, config.filename)
arr =  filemanager.readcsv(csvpath)
users = filemanager.arrayToUsers(arr)
precount = 0
for i in range(0,len(users)):
   if users[i].state == 'c':
      precount = precount +1
Exemplo n.º 2
0
import urllib
import config
import quapi
import parsers
import filemanager
import numpy as np
import pandas as pd
config.init()

#print(quapi.makeRequest(quapi.addRecipient(config.seedemail)))
print(quapi.sendSurveyToIndividual( 'MLRP_9YO0nUPyUo5vyDj', config.survey2id))
#print(quapi.makeRequest(quapi.sendSurveyToIndividualSubjectExpiry('MLRP_9YO0nUPyUo5vyDj', config.survey2id, 'poo')))
#print(quapi.sendSurveySubjectExpiry('*****@*****.**', config.survey2id, 'subject'))
#print((quapi.sendSurvey(config.seedemail,config.survey2id)))
filemanager.writecsv(parsers.parseForEmails(quapi.makeRequest(quapi.getLegacyResponseData(config.survey2id, config.survey2questions)),config.survey2refs), 'somefile.csv')

d = filemanager.readcsv('somefile.csv')
print(d[0][0])
filemanager.writecsv(d,'somefile.csv')

#print('\n\n\n')

#print(quapi.makeRequest(quapi.getLegacyResponseData(config.survey2id,config.survey2questions)))

#print(config.survey2questions[2])


#parsers.parseForEmail((quapi.makeRequest(quapi.getLegacyResponseDataOfIndividual('R_1gcgt9z0Oxa1B01', config.survey2id, config.survey2questions))), config.survey2questions)