![Timbr logo description](https://timbr.ai/wp-content/uploads/2023/06/timbr-ai-l-5-226x60-1.png)
# timbr REST API connector sample file
This project is a sample connecting to timbr using REST API from Python.
## 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 simple execution method REST API connector for Timbr, follow this [Simple execution example file](examples/simpleExecution.py)
- For an example of how to use the advanced execution method REST API connector for Timbr, follow this [Advanced execution example file](examples/advancedExecution.py)
## Connection parameters examples
### Simple execute parameters
```python
pytimbr_api.simpleQueryExecution(
url = "<TIMBR_URL>",
ontology = "<ONTOLOGY_NAME>",
token = "<USER_TOKEN>",
query = "<TIMBR_QUERY>",
datasource = "<DATASOURCE_NAME>",
nested = "<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.
```
### Advanced execute parameters
```python
pytimbr_api.advancedQueryExecute(
hostname = "<TIMBR_IP/HOST>",
port = "<TIMBR_PORT>",
ontology = "<ONTOLOGY_NAME>",
token = "<USER_TOKEN>",
query = "<TIMBR_QUERY>",
enabled_ssl = <True/False>,
verify_ssl = <True/False>,
nested = "<true/false>",
enableIPv6 = <True/False>,
datasource = "<DATASOURCE_NAME>",
)
# hostname - Required - String - The IP / Hostname of the Timbr platform.
# port - Required - String - Timbr's default port with enabled_ssl is 443 without SSL is 11000.
# 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.
# enabled_ssl - Optional - Boolean - Use True for HTTPS connection and False for HTTP connection.
# verify_ssl - Optional - Boolean - Verifying the target server's SSL Certificate, use False to disable this process.
# nested - Optional - String - Change to 'true' if nested flag needs to be enabled. make sure this flag contains string value not bool value.
# enableIPv6 - Optional - Boolean - Change to 'true' if you are using IPv6 connection.
# 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.
```
## Execute query examples
### Simple execution
#### HTTP connection
```python
# Example with dummy data for HTTP connections
response = pytimbr_api.simpleQueryExecution(
url = "http://mytimbrenv.com:443",
ontology = "my_ontology",
token = "tk_mytimbrtoken",
query = "SELECT * FROM timbr.sys_concepts",
)
print(response)
```
#### HTTPS connection
```python
# Example with dummy data for HTTPS connections
response = pytimbr_api.simpleQueryExecution(
url = "https://mytimbrenv.com:443",
ontology = "my_ontology",
token = "tk_mytimbrtoken",
query = "SELECT * FROM timbr.sys_concepts",
)
print(response)
```
### Advanced execution
#### HTTP connection
```python
# Example with dummy data for HTTP connections
response = pytimbr_api.advancedQueryExecute(
hostname = "mytimbrenv.com",
port = "443",
ontology = "my_ontology",
token = "tk_mytimbrtoken",
query = "SELECT * FROM timbr.sys_concepts",
enabled_ssl = False,
verify_ssl = False,
nested = "false",
)
print(response)
```
#### HTTPS connection
```python
# Example with dummy data for HTTPS connections
response = pytimbr_api.advancedQueryExecute(
hostname = "mytimbrenv.com",
port = "443",
ontology = "my_ontology",
token = "tk_mytimbrtoken",
query = "SELECT * FROM timbr.sys_concepts",
enabled_ssl = True,
verify_ssl = True,
nested = "false",
)
print(response)
```
Raw data
{
"_id": null,
"home_page": "https://github.com/WPSemantix/timbr_python_http",
"name": "pytimbr-api",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "timbr, timbr-http, timbr-https, timbr-rest, timbr-api, timbr-rest-api, timbr-connector, PyTimbrRestAPI, PyTimbr, pytimbrapi, PyTimbrAPI, pytimbr_api, PyTimbr_API",
"author": "timbr",
"author_email": "contact@timbr.ai",
"download_url": "https://files.pythonhosted.org/packages/8d/3c/91edb722448b3b043be54f48571b10311689d126734c46903103efa21145/pytimbr_api-1.0.4.tar.gz",
"platform": null,
"description": "![Timbr logo description](https://timbr.ai/wp-content/uploads/2023/06/timbr-ai-l-5-226x60-1.png)\r\n\r\n# timbr REST API connector sample file\r\nThis project is a sample connecting to timbr using REST API from Python.\r\n\r\n## Dependencies\r\n- Python 3.7.13+ or 3.8.x or 3.9.x\r\n\r\n## Installation\r\n- Install as clone repository:\r\n - Install Python: https://www.python.org/downloads/release/python-3713/\r\n\r\n- Install using pip and git:\r\n - `pip install git+https://github.com/WPSemantix/timbr_python_http`\r\n\r\n- Install using pip:\r\n - `pip install pytimbr-api`\r\n\r\n## Sample usage\r\n- For an example of how to use the simple execution method REST API connector for Timbr, follow this [Simple execution example file](examples/simpleExecution.py)\r\n- For an example of how to use the advanced execution method REST API connector for Timbr, follow this [Advanced execution example file](examples/advancedExecution.py)\r\n\r\n## Connection parameters examples\r\n\r\n### Simple execute parameters\r\n ```python\r\n pytimbr_api.simpleQueryExecution(\r\n url = \"<TIMBR_URL>\",\r\n ontology = \"<ONTOLOGY_NAME>\",\r\n token = \"<USER_TOKEN>\",\r\n query = \"<TIMBR_QUERY>\",\r\n datasource = \"<DATASOURCE_NAME>\",\r\n nested = \"<true/false>\",\r\n )\r\n\r\n # url - Required - String - The IP / Hostname of the Timbr platform.\r\n # ontology - Required - String - The ontology / knowledge graph to connect to.\r\n # token - Required - String - Timbr token value.\r\n # query - Required - String - The query that you want to execute.\r\n # 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.\r\n # nested - Optional - String - Change to 'true' if nested flag needs to be enabled. make sure this flag contains string value not bool value.\r\n ```\r\n\r\n### Advanced execute parameters\r\n ```python\r\n pytimbr_api.advancedQueryExecute(\r\n hostname = \"<TIMBR_IP/HOST>\",\r\n port = \"<TIMBR_PORT>\",\r\n ontology = \"<ONTOLOGY_NAME>\",\r\n token = \"<USER_TOKEN>\",\r\n query = \"<TIMBR_QUERY>\",\r\n enabled_ssl = <True/False>,\r\n verify_ssl = <True/False>,\r\n nested = \"<true/false>\",\r\n enableIPv6 = <True/False>,\r\n datasource = \"<DATASOURCE_NAME>\",\r\n )\r\n\r\n # hostname - Required - String - The IP / Hostname of the Timbr platform.\r\n # port - Required - String - Timbr's default port with enabled_ssl is 443 without SSL is 11000.\r\n # ontology - Required - String - The ontology / knowledge graph to connect to.\r\n # token - Required - String - Timbr token value.\r\n # query - Required - String - The query that you want to execute.\r\n # enabled_ssl - Optional - Boolean - Use True for HTTPS connection and False for HTTP connection.\r\n # verify_ssl - Optional - Boolean - Verifying the target server's SSL Certificate, use False to disable this process.\r\n # nested - Optional - String - Change to 'true' if nested flag needs to be enabled. make sure this flag contains string value not bool value.\r\n # enableIPv6 - Optional - Boolean - Change to 'true' if you are using IPv6 connection.\r\n # 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.\r\n ```\r\n\r\n## Execute query examples\r\n### Simple execution\r\n#### HTTP connection\r\n ```python\r\n # Example with dummy data for HTTP connections\r\n response = pytimbr_api.simpleQueryExecution(\r\n url = \"http://mytimbrenv.com:443\",\r\n ontology = \"my_ontology\",\r\n token = \"tk_mytimbrtoken\",\r\n query = \"SELECT * FROM timbr.sys_concepts\",\r\n )\r\n print(response)\r\n```\r\n\r\n#### HTTPS connection\r\n ```python\r\n # Example with dummy data for HTTPS connections\r\n response = pytimbr_api.simpleQueryExecution(\r\n url = \"https://mytimbrenv.com:443\",\r\n ontology = \"my_ontology\",\r\n token = \"tk_mytimbrtoken\",\r\n query = \"SELECT * FROM timbr.sys_concepts\",\r\n )\r\n print(response)\r\n```\r\n\r\n### Advanced execution\r\n#### HTTP connection\r\n ```python\r\n # Example with dummy data for HTTP connections\r\n response = pytimbr_api.advancedQueryExecute(\r\n hostname = \"mytimbrenv.com\",\r\n port = \"443\",\r\n ontology = \"my_ontology\",\r\n token = \"tk_mytimbrtoken\",\r\n query = \"SELECT * FROM timbr.sys_concepts\",\r\n enabled_ssl = False,\r\n verify_ssl = False,\r\n nested = \"false\",\r\n )\r\n print(response)\r\n```\r\n\r\n#### HTTPS connection\r\n ```python\r\n # Example with dummy data for HTTPS connections\r\n response = pytimbr_api.advancedQueryExecute(\r\n hostname = \"mytimbrenv.com\",\r\n port = \"443\",\r\n ontology = \"my_ontology\",\r\n token = \"tk_mytimbrtoken\",\r\n query = \"SELECT * FROM timbr.sys_concepts\",\r\n enabled_ssl = True,\r\n verify_ssl = True,\r\n nested = \"false\",\r\n )\r\n print(response)\r\n```\r\n\r\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Timbr REST API connector",
"version": "1.0.4",
"project_urls": {
"Bug Tracker": "https://github.com/WPSemantix/timbr_python_http/issues",
"Download": "https://github.com/WPSemantix/timbr_python_http/archive/refs/tags/v1.0.4.tar.gz",
"Homepage": "https://github.com/WPSemantix/timbr_python_http"
},
"split_keywords": [
"timbr",
" timbr-http",
" timbr-https",
" timbr-rest",
" timbr-api",
" timbr-rest-api",
" timbr-connector",
" pytimbrrestapi",
" pytimbr",
" pytimbrapi",
" pytimbrapi",
" pytimbr_api",
" pytimbr_api"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "8d3c91edb722448b3b043be54f48571b10311689d126734c46903103efa21145",
"md5": "786aa98b8ec66c2f4cc1c80a29f85055",
"sha256": "399f271cc22b71a3b6518989c676eafb89dacac1bfc092cd3617f32310c586aa"
},
"downloads": -1,
"filename": "pytimbr_api-1.0.4.tar.gz",
"has_sig": false,
"md5_digest": "786aa98b8ec66c2f4cc1c80a29f85055",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 4807,
"upload_time": "2024-09-26T12:51:03",
"upload_time_iso_8601": "2024-09-26T12:51:03.373555Z",
"url": "https://files.pythonhosted.org/packages/8d/3c/91edb722448b3b043be54f48571b10311689d126734c46903103efa21145/pytimbr_api-1.0.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-09-26 12:51:03",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "WPSemantix",
"github_project": "timbr_python_http",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "pytimbr-api"
}