Timbr REST API connector
Project description
timbr REST API connector using Python
This project is a pure python connector to timbr (no dependencies required).
Dependencies
- Python 3.7.13+ or 3.8.x or 3.9.x
Installation
-
Install as clone repository:
- Install Python: https://www.python.org/downloads/release/python-3713/
-
Install using pip and git:
pip install git+https://github.com/WPSemantix/timbr_python_http
-
Install using pip:
pip install pytimbr-api
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.
# 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.
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,
)
Execute query examples
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)
Project details
Release history Release notifications | RSS feed
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.7.tar.gz
(4.7 kB
view details)
File details
Details for the file pytimbr_api-1.0.7.tar.gz.
File metadata
- Download URL: pytimbr_api-1.0.7.tar.gz
- Upload date:
- Size: 4.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fa6b04645e1d1a34a731727c0e2d90f41ad3ff703d6f4f07d3a5ffb9a991f908
|
|
| MD5 |
c275f335c365d83e9d6a2bcfcbbd4400
|
|
| BLAKE2b-256 |
f243bf9fe90e50100fa03d817d1b7627aad7e939e872c059b3354b3d33e44e35
|