Skip to main content

Python framework to connect Spkio Server

Project description

pyspkio

Package for SPKIO API

to build

. env/bin/activate
pip install -r requirements.txt --upgrade
python3 -m build

to upload

python3 -m twine upload --repository pypi dist/*

ref:

Packaging project

To use

import pyspkio.spkio as spk

conn = spk.Spkio(host='localhost', token='your_token', pool_connections=10, pool_maxsize=12)

Nodes

# Create a source
id_src = conn.createSource({
    'source': 'Test Source',
    'date': {
        'year': 2023,
        'month': 10,
        'day': None
    }
})
# Create a glossary
id_glossary = conn.createGlossary({
    'tx_text': '{{test:key}}'
}, idSource, relevance=0, searchable=False)
# Create a node
id_node = conn.createNode({
    'idFrom': None,  # None for root node
    'idTo': None,
    'idKey': 'test_key', # this is high priority key than the pass by argument
    'idContent': None,

    'text': 'test',
    'integer': 6,
    'decimal': 1.2,
    'datetime': {
        'year': 2025,
        'month': 7,
        'day': 12,
        'hour': 23,
        'minute': 45,
        'second': 4,
        'timezone': 3,
        'about': 1
    }
}, idKey=id_glossary, idSource=id_src)

Links

# Create a link
# Create a node and, after, bind it to the node
id_link = conn.createLink(
    idFrom=id_node,
    idKey=id_glossary, # key for the node
    el={
        'idContent': None,
        'text': 'test link',
        'integer': 6,
        'decimal': 1.2,
        'datetime': {
            'year': 2025,
            'month': 7,
            'day': 12,
            'hour': 23,
            'minute': 45,
            'second': 4,
            'timezone': 3,
            'about': 1
        }
    },
    idSource=id_src,
    idKeyBind=id_glossary  # this is the key for the link, default is None
)
# Create a bind link
# This creates a link between the node and another node
id_link = conn.bindLink(
    idFrom=id_node,
    idKey=id_glossary,
    idTo='id_another_node', 
    idSource=id_src
)

Upload

# Upload a file
id_upload = conn.upload(
    path_file,
    id_key=None,
    id_source=None
)

Acquisition

# Verify an acquisition by SHA512
id_acquisition = conn.getAcquisitionBySha512({
    'sha512': 'sha512_hash_of_the_file'
})
# Notify an acquisition
id_acquisition = conn.postAcquisitionBySha512MarkDone({
    'sha512': 'sha512_hash_of_the_file',
    'tag': 'acquisition_tag'
})

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyspkio-0.0.28.tar.gz (5.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyspkio-0.0.28-py3-none-any.whl (4.6 kB view details)

Uploaded Python 3

File details

Details for the file pyspkio-0.0.28.tar.gz.

File metadata

  • Download URL: pyspkio-0.0.28.tar.gz
  • Upload date:
  • Size: 5.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.4

File hashes

Hashes for pyspkio-0.0.28.tar.gz
Algorithm Hash digest
SHA256 fda1cb00b4f7009ac182f17ea713a2e6d99dc25c1cb2c2c39408edbb015bc682
MD5 c1f40c7af464afe0ff1d947eae9c980b
BLAKE2b-256 396e21240847cb5a39c59e638ca45765e031c7f3df75c23d656022d8fa14b02a

See more details on using hashes here.

File details

Details for the file pyspkio-0.0.28-py3-none-any.whl.

File metadata

  • Download URL: pyspkio-0.0.28-py3-none-any.whl
  • Upload date:
  • Size: 4.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.4

File hashes

Hashes for pyspkio-0.0.28-py3-none-any.whl
Algorithm Hash digest
SHA256 a549203b018d45a9725868614384abc7486ce616ce66d7026e386bc2c06b311b
MD5 5c27cc2c9ddc2f19a0a339dc83723698
BLAKE2b-256 e8305f5c9d92304799889e7d31ceb531db46dcbbbbbd59a67423c10a9baba543

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page