与LiveIntent隐私API交互的CLI和示例应用程序
li-privac的Python项目详细描述
安装python和pip
li隐私工具需要python。正确地设置python和pip可能是整个设置中最棘手的部分。(为什么,哦,为什么,python很难正确设置?)在
要验证是否正确安装了python和pip,您应该能够从终端/命令提示符运行以下命令:
$ python --version
$ pip --version
^{pr2}$TIP: If you get an error that python or pip do not exist, consider trying:
还是不走运?然后从https://www.python.org/downloads/下载并为您的操作系统安装最新版本的python/pip。在
TIP: During the installation, if there is an option to add python to your path, please be sure to select that option!
安装li隐私工具
运行以下命令自动下载并安装li隐私客户端:
$ pip install li-privacy
...
[ Installation takes place... lots of ... stuff ]
...
Successfully installed li-privacy
TIP: Depending upon your python installation and user permissions, you may receive an error that some files or directories cannot be written. This is a common problem with python setups. If this happens you have a few options. One is to try re-running the command-prompt as an administrator or using
sudo
if you are on Mac/Linux. Another option is to try installing the package in "user" mode:
$ pip install --user li-privacy
要验证li-privacy
工具是否已正确安装,请运行:
$ li-privacy --version
li-privacy v.1.2.2
ERROR: If you receive an error that li-privacy does not exist, then your python/pip installation is not setup to place installed modules in your executable PATH.
配置帐户并生成密钥
li-privacy init
命令将开始设置您的帐户。程序将提示您输入公司的域名(即。liveintent.com网站),密钥标识符和RSSA签名密钥的路径(如果要使用现有密钥)。在
TIP: If you do not already have an RSA signing key (which is usually the case), you may press
<ENTER>
for the key-identifier and Private RSA signing key prompts and a new key will be automatically generated for you.
要设置帐户,请运行li-privacy init
命令。(注:用户提供的输入用**
表示):
$ li-privacy init
Creating new config: config.json
Your domain name: **publisher.com**
Key Identifier: (key1) **<ENTER>**
Private RSA signing key file: (publisher.com.key) **<ENTER>**
Generated new keys in publisher.com.key and publisher.com.key.pub
Configuration written to config.json
To provision your keys, please email the following files to privacy@liveintent.com:
config.json
publisher.com.key.pub
初始化过程将生成以下文件:
Filename | Description |
---|---|
config.json | Contains the settings for your account. Send to LiveIntent. |
{domain_name}.key.pub | Your public RSA Key. Send to LiveIntent. |
{domain_name}.key | Your private RSA Key. DO NOT SEND outside your company. |
完成此过程后,请将这两个文件通过电子邮件发送到privacy@liveintent.com。一旦您的帐户已经设置好,您将收到通知并准备提交交易。在
WARNING: Be careful to submit the correct files, as the public and private key filenames are very similar.
使用dailyplanet.com网站示例帐户
当您等待配置自己的帐户时,您可以利用API指南中提供的示例凭据向登台系统提交实践请求。为了方便起见,li隐私工具将为您生成这些内容。在
重新运行init命令,当提示输入域名时,输入“dailyplanet.com网站". 在
$ li-privacy init
Using existing config: config.json
Your domain name: **dailyplanet.com**
Generating example key and configuration
Saved example keys in dailyplanet.com.key and dailyplanet.com.key.pub
Configuration written to dailyplanet.json
要使用这些示例键,只需在运行命令时添加--config dailyplanet.config
。在
每日行星配置和钥匙现在可以通过dailyplanet.json“文件。传递--config dailyplanet.json
标志以使用此帐户,。在
$ li-privacy optout user@domain.com --config dailyplanet.json
{"reference":"01DZ1W5VCT6F0M1V345F8G07GY", "read":3, "imported":3}
使用li隐私工具删除或删除用户
以下命令仅在LiveIntent设置了您的公钥后才起作用。在等待建立密钥时,可以使用dailyplanet.com网站实例说明练习。在
选择退出单个用户
要选择退出单个用户,请调用optout
命令并提供哈希或电子邮件地址。在
按哈希选择退出示例:
$ li-privacy optout cd2bfcffe5fee4a1149d101994d0987f
{"reference":"01DZ1TWYBXQ37M0N8VPAKM1RFB", "read":1, "imported":1}
如果命令成功,它将显示一个参考号和已处理的记录数。在
NOTE: If an email address is specified, the address will automatically be hashed as MD5, SHA1, and SHA256 before submitting (thus the result shows 3 records):
通过电子邮件选择退出示例:
$ li-privacy optout user@domain.com
{"reference":"01DZ1KBHPKBRJG1D1DT8HP0ZBQ", "read":3, "imported":3}
选择用户列表
如果有多个用户要退出,则可以指定包含用户列表的文本文件的路径。将在每个文件中生成一个单独的报告行。该文件应包含一个电子邮件地址或每行一个哈希,没有其他列或数据。在
选择退出多个用户示例:
$ li-privacy optout path/to/users.txt
Processing users from file path/to/users.txt
...
Report saved to path/to/users.txt.20200101120000.tsv
删除用户
delete
命令使用与optout
命令相同的参数,但是命令名是delete
。在
$ li-privacy delete cd2bfcffe5fee4a1149d101994d0987f
{"reference":"01DZ1TWYBXQ37M0N8VPAKM1RFB", "read":1, "imported":1}
- 项目
标签: