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.27.tar.gz (5.0 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.27-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pyspkio-0.0.27.tar.gz
  • Upload date:
  • Size: 5.0 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.27.tar.gz
Algorithm Hash digest
SHA256 444e20d7e431c97dd0a0fb28b8f703fddae9c1432d35af95692881ae3e6d238a
MD5 b848398ce85e37986581132cc2691b46
BLAKE2b-256 b4b1de867170844801e655d14a8c2cd1513589b54fa7be7300858fbce4a61126

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pyspkio-0.0.27-py3-none-any.whl
  • Upload date:
  • Size: 4.3 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.27-py3-none-any.whl
Algorithm Hash digest
SHA256 c27ac471a7d0540b10112d2f6ac3cfd459a4a2c58886169a0a71292285e032dc
MD5 ac467ffb43bb722f4ce718834aac4384
BLAKE2b-256 0965c887ce37c0d74f33f0c60d9b2741f4073236b7c31afccb93d1c9582d10a0

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