Skip to main content

基于 Python 的链接数据通知库

项目描述

版本 构建状态 覆盖状态

这是一个基于 python3 的关联数据通知发送者和消费者的实现。

安装

点安装py-ldnlib

将 LDN 发件人添加到您的代码中

一个简单的 LDN Sender 可以写成:

import ldnlib

sender = ldnlib.Sender()

inbox = sender.discover(target_resource)

if inbox is not None:
    sender.send(inbox, data)

数据值可以是字符串、字典、列表或基于rdflibGraph。

将 LDN 使用者添加到您的代码中

一个简单的 LDN 消费者可以写成:

import ldnlib

consumer = ldnlib.Consumer()

inbox = consumer.discover(target_resource)

if inbox is not None:
    for iri in consumer.notifications(inbox):
        // fetch the notification as a Python dictionary
        notification = consumer.notification(iri)

验证

如果目标资源或收件箱资源需要身份验证,则可以提供一个身份验证元组:

import ldnlib

sender = ldnlib.Sender()

inbox = sender.discover(target_resource, auth=(username, password))

if inbox is not None:
    sender.send(inbox, data, auth=(username, password))

维护者

亚伦·科本

项目详情


下载文件

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

源分布

py-ldnlib-0.1.3.tar.gz (3.6 kB 查看哈希

已上传 source

内置分布

py_ldnlib-0.1.3-py3-none-any.whl (4.5 kB 查看哈希

已上传 py3