透明信息语言和工具包(TILT)的python语言绑定
tilt的Python项目详细描述
python-tilt |透明信息语言和工具包
什么是透明信息语言和工具箱?在
在这个关于数据隐私的透明信息的方案中,向复杂的生态系统迈出的重要一步是,引入一个基于描述多服务环境下透明度信息的正式语言模型和最新法律要求(欧盟一般数据保护条例)的透明度增强工具包。所期望的工作结果应该是合适的,为开发者准备使用隐私工程解决方案,并作为这一领域进一步研究的起点。最终,数据主体应该(能够)通过使用工具箱的接口来理解与其相关的数据发生了什么。在
什么是python tilt?在
tilt是一种基于Python的语言绑定,用于Transparency Information language and Toolkit。在
安装
使用pip安装python客户机库。参见project page。在
foo@bar:~$ pip3 install tilt Collecting tilt Using cached tilt-0.0.1-py3-none-any.whl (22 kB)Installing collected packages: tiltSuccessfully installed tilt-0.0.1
基本用途
在这里可以看到一个交互式游乐场,在这个游戏中,您可以在Juypter笔记本中运行python-tilt。在
- 导入透明信息语言绑定/库。在
- 创建您的第一个对象,例如数据保护官员及其联系方式。在
- 继续创建对象,即控制器及其代表。在
- 。。。(添加所有其他字段,此处未显示)。。。在
导入现有文档
为了导入现有的tilt文档(我们称之为实例),您可以使用您喜欢的HTTP客户端或从本地磁盘加载。然后,您可以使用本机python对象并按您的喜好进行任何操作。
^{pr 3}$Create new documents from scratch
In the example below we are using standard libraries (e.g. sha256 or datetime) in order to create formatted strings. All objects have ^{
Validate documents
See the following example code on how to validate documents using fastjsonschema。在
importfastjsonschemaimportjsonimportrequests# Load schema to validate againstfile=requests.get('https://raw.githubusercontent.com/Transparency-Information-Language/schema/master/tilt-schema.json')schema=json.loads(file.content)# Load instance/document to validate;# you may use your own tilt object with .to_dict() herefile=requests.get('https://raw.githubusercontent.com/Transparency-Information-Language/schema/master/tilt.json')instance=json.loads(file.content)# Compile schemavalidate_func=fastjsonschema.compile(schema)# Validate instance against schemavalidate_func(instance)## {'meta': {'_id': 'f1424f86-ca0f-4f0c-9438-43cc00509931', 'name': 'Green Company', 'created': '2020-04-03T15:53:05.929588', 'modified': '2020-04-03T15:53:05.929588',...## => document is valid# Load another examplefile=requests.get('https://raw.githubusercontent.com/Transparency-Information-Language/schema/master/tilt-NOT-valid.json')instance=json.loads(file.content)# Validate another examplevalidate_func(instance)## JsonSchemaException: data.controller must contain ['name', 'address', 'country', 'representative'] properties## => document is invalid
作者
埃利亚斯·格吕纽瓦尔德
许可证
GNU通用公共许可证,版本3
- 项目
标签: