促进质量调查管理的图书馆。需要Qualtrics API。
py-qualtrics-api的Python项目详细描述
此软件包包括使用Qualtrics API的方法:
- 复制调查
- 删除调查
- 激活调查
- 创建邮件列表
- 删除邮件列表
- 将联系人添加到邮件列表中
- 为邮件列表成员生成唯一的调查链接
- 为消息库创建消息
- 使用邮件库中的邮件将调查分发到邮件列表
安装
pip install py_qualtrics_api
概述
示例用法:
import py_qualtrics_api.tools as pq import pandas as pd q = pq.QualtricsAPI('config.yml') # copy survey sid = q.copy_survey('SV_0abc05URqqrhMOO', 'My new survey') # delete survey success = q.delete_survey(sid) # copy survey, then activate the new survey sid = q.copy_survey('SV_0abc05URqqrhMOO', 'My new survey') success = q.activate_survey(sid) # create mailing list and add records from a Pandas dataframe # dataframe must contain an 'email' column (not case sensitive) # other optional special columns are: 'firstname', 'lastname', # 'externaldataref', 'unsubscribed' (defaults to false), # 'language' (defaults to en) # none of these special column names are case sensitive, so # ExTeRnAlDaTaRef would be acceptable mail_list = pd.read_csv('test_mailing_list.csv') ml_id = q.create_mailing_list('New mailing list', records_to_add=mail_list, list_category='API') # generate individual survey links for a mailing list # optional parameter link_type defaults to 'Individual' but other # valid values are 'Multiple' and 'Anonymous' # return value is a pandas data frame of the core contact info with # the following added columns: contactId, exceededContactFrequency, # 'link', 'linkExpiration', 'status', 'unsubscribed' links = q.get_links_for_mailing_list(sid, ml_id)
配置文件示例(config.yml):
api_token: '4ru9we8fuper9ugergijergoijer34gierj876' data_center: 'co1' default_survey_owner: 'UR_3wjehoefof93s' default_library_owner: 'UR_3wjehoefof93s'
如果不想在配置文件中存储api令牌,可以 省略那一行。如果配置文件中不存在api令牌,则 将在创建Qualtricsapi对象时提示输入。