Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/trellis-ldp/py-ldnlib
Python-based Linked Data Notification libraries
https://github.com/trellis-ldp/py-ldnlib
ldn-consumer ldn-sender linked-data-notifications
Last synced: about 2 months ago
JSON representation
Python-based Linked Data Notification libraries
- Host: GitHub
- URL: https://github.com/trellis-ldp/py-ldnlib
- Owner: trellis-ldp
- License: apache-2.0
- Created: 2017-02-25T20:48:06.000Z (almost 8 years ago)
- Default Branch: main
- Last Pushed: 2024-01-02T02:25:01.000Z (12 months ago)
- Last Synced: 2024-09-15T23:38:12.580Z (3 months ago)
- Topics: ldn-consumer, ldn-sender, linked-data-notifications
- Language: Python
- Homepage:
- Size: 52.7 KB
- Stars: 13
- Watchers: 8
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.rst
- License: LICENSE
Awesome Lists containing this project
README
Python-based Linked Data Notifications libraries
================================================.. image:: https://github.com/trellis-ldp/py-ldnlib/workflows/Python%20Linked%20Data%20Notifications/badge.svg
:target: https://github.com/trellis-ldp/py-ldnlib
:alt: Build Status.. image:: https://badge.fury.io/py/py-ldnlib.svg
:target: https://badge.fury.io/py/py-ldnlib
:alt: VersionThis is an implementation of a python3-based `Linked Data Notification `_ sender and consumer.
Installing
----------``pip install py-ldnlib``
Adding an LDN sender to your code
---------------------------------A simple LDN Sender could be written as:
.. code-block::
import ldnlib
sender = ldnlib.Sender()
inbox = sender.discover(target_resource)
if inbox is not None:
sender.send(inbox, data)The ``data`` value may be a string, a dictionary, a list or an ``rdflib``\ -based Graph.
Adding an LDN consumer to your code
-----------------------------------A simple LDN Consumer could be written as:
.. code-block::
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)Authentication
--------------If the target-resource or inbox-resource requires authentication, an ``auth`` tuple may be supplied:
.. code-block::
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))Maintainer
----------`Aaron Coburn `_