Skip to main content

Timbr REST API connector

Project description

Timbr logo

FOSSA Status FOSSA Status

Python 3.9 Python 3.10 Python 3.11 Python 3.12

PypiVersion

timbr REST API connector using Python

This project is a pure python connector to timbr (no dependencies required).

Dependencies

  • Access to a timbr-server
  • Python from 3.9.13 or newer

Installation

Sample usage

  • For an example of how to use the REST API connector for Timbr, follow this Example file

Connection parameters examples

Generic example and explanation for each parameter

  pytimbr_api.run_query(
    url = "<TIMBR_URL>",
    ontology = "<ONTOLOGY_NAME>",
    token = "<USER_TOKEN>",
    query = "<TIMBR_QUERY>",
    datasource = "<DATASOURCE_NAME>",
    nested = "<true/false>",
    verify_ssl = <True/False>,
    enable_IPv6 = <True/False>,
  )

  # url           - Required - String - The IP / Hostname of the Timbr platform.
  # ontology      - Required - String - The ontology / knowledge graph to connect to.
  # token         - Required - String - Timbr token value or JWT token value. Note: If you are using JWT token, you need to set the is_jwt parameter to True.
  # query         - Required - String - The query that you want to execute.
  # datasource    - Optional - String - Add the specific datasource name that you want to query from, the default value is the current active datasource of your ontology.
  # nested        - Optional - String - Change to 'true' if nested flag needs to be enabled. make sure this flag contains string value not bool value.
  # verify_ssl    - Optional - Boolean - Verifying the target server's SSL Certificate, use False to disable this process.
  # enable_IPv6   - Optional - Boolean - Change to 'true' if you are using IPv6 connection.
  # is_jwt        - Optional - Boolean - Set to True if you are using JWT token, otherwise set to False.
  # jwt_tenant_id - Optional - String - The tenant ID for JWT authentication

Using Timbr token

HTTP example

  pytimbr_api.run_query(
    url = "http://mytimbrenv.com:11000",
    ontology = "my_ontology",
    token = "tk_mytimbrtoken",
    query = "SELECT * FROM timbr.sys_concepts",
    datasource = "my_datasource",
    nested = "false",
    verify_ssl = False,
    enable_IPv6 = False,
  )

HTTPS example

  pytimbr_api.run_query(
    url = "https://mytimbrenv.com:443",
    ontology = "my_ontology",
    token = "tk_mytimbrtoken",
    query = "SELECT * FROM timbr.sys_concepts",
    datasource = "my_datasource",
    nested = "false",
    verify_ssl = True,
    enable_IPv6 = False,
  )

Using JWT token

HTTP example

  pytimbr_api.run_query(
    url = "http://mytimbrenv.com:11000",
    ontology = "my_ontology",
    token = "tk_mytimbrtoken",
    query = "SELECT * FROM timbr.sys_concepts",
    datasource = "my_datasource",
    nested = "false",
    verify_ssl = False,
    enable_IPv6 = False,
    is_jwt = True,
    jwt_tenant_id = "my_tenant_id",
  )

HTTPS example

  pytimbr_api.run_query(
    url = "https://mytimbrenv.com:11000",
    ontology = "my_ontology",
    token = "tk_mytimbrtoken",
    query = "SELECT * FROM timbr.sys_concepts",
    datasource = "my_datasource",
    nested = "false",
    verify_ssl = True,
    enable_IPv6 = False,
    is_jwt = True,
    jwt_tenant_id = "my_tenant_id",
  )

Execute query examples

Using Timbr token

HTTP connection

  response = pytimbr_api.run_query(
    url = "http://mytimbrenv.com:11000",
    ontology = "my_ontology",
    token = "tk_mytimbrtoken",
    query = "SELECT * FROM timbr.sys_concepts",
    datasource = "my_datasource",
    nested = "false",
    verify_ssl = False,
    enable_IPv6 = False,
  )
  print(response)

HTTPS connection

  response = pytimbr_api.run_query(
    url = "https://mytimbrenv.com:443",
    ontology = "my_ontology",
    token = "tk_mytimbrtoken",
    query = "SELECT * FROM timbr.sys_concepts",
    datasource = "my_datasource",
    nested = "false",
    verify_ssl = True,
    enable_IPv6 = False,
  )
  print(response)

Using JWT token

HTTP example

  response = pytimbr_api.run_query(
    url = "http://mytimbrenv.com:11000",
    ontology = "my_ontology",
    token = "tk_mytimbrtoken",
    query = "SELECT * FROM timbr.sys_concepts",
    datasource = "my_datasource",
    nested = "false",
    verify_ssl = False,
    enable_IPv6 = False,
    is_jwt = True,
    jwt_tenant_id = "my_tenant_id",
  )
  print(response)

HTTPS example

  response = pytimbr_api.run_query(
    url = "https://mytimbrenv.com:11000",
    ontology = "my_ontology",
    token = "tk_mytimbrtoken",
    query = "SELECT * FROM timbr.sys_concepts",
    datasource = "my_datasource",
    nested = "false",
    verify_ssl = True,
    enable_IPv6 = False,
    is_jwt = True,
    jwt_tenant_id = "my_tenant_id",
  )
  print(response)

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

pytimbr_api-1.0.9.tar.gz (6.8 kB view details)

Uploaded Source

Built Distribution

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

pytimbr_api-1.0.9-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

Details for the file pytimbr_api-1.0.9.tar.gz.

File metadata

  • Download URL: pytimbr_api-1.0.9.tar.gz
  • Upload date:
  • Size: 6.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for pytimbr_api-1.0.9.tar.gz
Algorithm Hash digest
SHA256 1eeb5afbca3b9df4525881a9d4ff7c873f6bd5a91b011e6d2e320204ada9340d
MD5 df0ca0f6d810331f175f51505d797998
BLAKE2b-256 8e5a23b1a57e0027244e938f4690a8466242e9d8076b0a86bc4db99f40913e1d

See more details on using hashes here.

File details

Details for the file pytimbr_api-1.0.9-py3-none-any.whl.

File metadata

  • Download URL: pytimbr_api-1.0.9-py3-none-any.whl
  • Upload date:
  • Size: 5.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for pytimbr_api-1.0.9-py3-none-any.whl
Algorithm Hash digest
SHA256 dcd22b6fae3a23b0e94a2730c94563d75b81f7754864e2d38559172bb2f2f979
MD5 7a86e81079c1432ac31a57d2cdc18dea
BLAKE2b-256 468345350e649a8057dd9f28a7fbe972f30e3069a8c1080cf5e7830fa0e58af4

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