Skip to main content

使用 Qualtrics 促进调查管理的图书馆。需要 Qualtrics API。

项目描述

这个包包括使用 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 对象时提示您输入它。

项目详情


下载文件

下载适用于您平台的文件。如果您不确定要选择哪个,请了解有关安装包的更多信息。

源分布

py_qualtrics_api-0.3.0.tar.gz (7.4 kB 查看哈希

已上传 source