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,
    mime_type=None,  # Optional, if not provided it will be guessed from the file extension
)
# Upload a file and link it to a node
linkUpload(
    id_from,
    id_key,
    path_file,
    id_source,
    mime_type=None,
    id_key_bind=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.31.tar.gz (5.3 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.31-py3-none-any.whl (4.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pyspkio-0.0.31.tar.gz
  • Upload date:
  • Size: 5.3 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.31.tar.gz
Algorithm Hash digest
SHA256 e19e7ddf79f328904774e076fe6795a79d32ab670f42636004f977ccdd2d3990
MD5 c20a74ce811280cd2a76343ad0ccbcf5
BLAKE2b-256 c7e2b0c8554181559dac93a5e7a97c3372efd0d073aef6238e47969878452d33

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pyspkio-0.0.31-py3-none-any.whl
  • Upload date:
  • Size: 4.7 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.31-py3-none-any.whl
Algorithm Hash digest
SHA256 91ec3b3839fab2c9a2a168eb61a979f77c5491f214d8d89ebf18c0d026b1283c
MD5 1d6aea173eeac341836c175a4d0a3c72
BLAKE2b-256 8aebe5de31fe71d81bff8edbd84528c51085c4ec34cf9589ac3f079c672ebfc6

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