
[](https://app.fossa.com/projects/custom%2B50508%2Fgithub.com%2FWPSemantix%2Ftimbr_python_http?ref=badge_shield&issueType=license)
[](https://app.fossa.com/projects/custom%2B50508%2Fgithub.com%2FWPSemantix%2Ftimbr_python_http?ref=badge_shield&issueType=security)
[](https://www.python.org/downloads/release/python-3921/)
[](https://www.python.org/downloads/release/python-31017/)
[](https://www.python.org/downloads/release/python-31112/)
[](https://www.python.org/downloads/release/python-3129/)
[](https://badge.fury.io/py/pytimbr-api)
# 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
- Install as clone repository:
- Install Python: https://www.python.org/downloads/release/python-3913/
- 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](examples/example.py)
## Connection parameters examples
### Generic example and explanation for each parameter
```python
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
```python
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
```python
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
```python
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
```python
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
```python
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
```python
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
```python
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
```python
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)
```
Raw data
{
"_id": null,
"home_page": null,
"name": "pytimbr-api",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": "timbr <contact@timbr.ai>",
"keywords": "timbr, timbr-http, timbr-https, timbr-rest, timbr-api, timbr-rest-api, timbr-connector, PyTimbrRestAPI, PyTimbr, pytimbrapi, PyTimbrAPI, pytimbr_api, PyTimbr_API",
"author": null,
"author_email": "timbr <contact@timbr.ai>",
"download_url": "https://files.pythonhosted.org/packages/d1/9c/fdb6d80c7e06f0be0dc7231fb91b5d120b52011c9cefe237320e0129bb04/pytimbr_api-1.0.10.tar.gz",
"platform": null,
"description": "\r\n\r\n[](https://app.fossa.com/projects/custom%2B50508%2Fgithub.com%2FWPSemantix%2Ftimbr_python_http?ref=badge_shield&issueType=license)\r\n[](https://app.fossa.com/projects/custom%2B50508%2Fgithub.com%2FWPSemantix%2Ftimbr_python_http?ref=badge_shield&issueType=security)\r\n\r\n[](https://www.python.org/downloads/release/python-3921/)\r\n[](https://www.python.org/downloads/release/python-31017/)\r\n[](https://www.python.org/downloads/release/python-31112/)\r\n[](https://www.python.org/downloads/release/python-3129/)\r\n\r\n[](https://badge.fury.io/py/pytimbr-api)\r\n\r\n# timbr REST API connector using Python\r\nThis project is a pure python connector to timbr (no dependencies required).\r\n\r\n## Dependencies\r\n- Access to a timbr-server\r\n- Python from 3.9.13 or newer\r\n\r\n## Installation\r\n- Install as clone repository:\r\n - Install Python: https://www.python.org/downloads/release/python-3913/\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 REST API connector for Timbr, follow this [Example file](examples/example.py)\r\n\r\n## Connection parameters examples\r\n\r\n### Generic example and explanation for each parameter\r\n```python\r\n pytimbr_api.run_query(\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 verify_ssl = <True/False>,\r\n enable_IPv6 = <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 or JWT token value. Note: If you are using JWT token, you need to set the is_jwt parameter to True.\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 # verify_ssl - Optional - Boolean - Verifying the target server's SSL Certificate, use False to disable this process.\r\n # enable_IPv6 - Optional - Boolean - Change to 'true' if you are using IPv6 connection.\r\n # is_jwt - Optional - Boolean - Set to True if you are using JWT token, otherwise set to False.\r\n # jwt_tenant_id - Optional - String - The tenant ID for JWT authentication\r\n```\r\n\r\n### Using Timbr token\r\n\r\n#### HTTP example\r\n```python\r\n pytimbr_api.run_query(\r\n url = \"http://mytimbrenv.com:11000\",\r\n ontology = \"my_ontology\",\r\n token = \"tk_mytimbrtoken\",\r\n query = \"SELECT * FROM timbr.sys_concepts\",\r\n datasource = \"my_datasource\",\r\n nested = \"false\",\r\n verify_ssl = False,\r\n enable_IPv6 = False,\r\n )\r\n```\r\n\r\n#### HTTPS example\r\n```python\r\n pytimbr_api.run_query(\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 datasource = \"my_datasource\",\r\n nested = \"false\",\r\n verify_ssl = True,\r\n enable_IPv6 = False,\r\n )\r\n```\r\n\r\n### Using JWT token\r\n\r\n#### HTTP example\r\n```python\r\n pytimbr_api.run_query(\r\n url = \"http://mytimbrenv.com:11000\",\r\n ontology = \"my_ontology\",\r\n token = \"tk_mytimbrtoken\",\r\n query = \"SELECT * FROM timbr.sys_concepts\",\r\n datasource = \"my_datasource\",\r\n nested = \"false\",\r\n verify_ssl = False,\r\n enable_IPv6 = False,\r\n is_jwt = True,\r\n jwt_tenant_id = \"my_tenant_id\",\r\n )\r\n```\r\n\r\n#### HTTPS example\r\n```python\r\n pytimbr_api.run_query(\r\n url = \"https://mytimbrenv.com:11000\",\r\n ontology = \"my_ontology\",\r\n token = \"tk_mytimbrtoken\",\r\n query = \"SELECT * FROM timbr.sys_concepts\",\r\n datasource = \"my_datasource\",\r\n nested = \"false\",\r\n verify_ssl = True,\r\n enable_IPv6 = False,\r\n is_jwt = True,\r\n jwt_tenant_id = \"my_tenant_id\",\r\n )\r\n```\r\n\r\n## Execute query examples\r\n\r\n### Using Timbr token\r\n\r\n#### HTTP connection\r\n```python\r\n response = pytimbr_api.run_query(\r\n url = \"http://mytimbrenv.com:11000\",\r\n ontology = \"my_ontology\",\r\n token = \"tk_mytimbrtoken\",\r\n query = \"SELECT * FROM timbr.sys_concepts\",\r\n datasource = \"my_datasource\",\r\n nested = \"false\",\r\n verify_ssl = False,\r\n enable_IPv6 = False,\r\n )\r\n print(response)\r\n```\r\n\r\n#### HTTPS connection\r\n```python\r\n response = pytimbr_api.run_query(\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 datasource = \"my_datasource\",\r\n nested = \"false\",\r\n verify_ssl = True,\r\n enable_IPv6 = False,\r\n )\r\n print(response)\r\n```\r\n\r\n### Using JWT token\r\n\r\n#### HTTP example\r\n```python\r\n response = pytimbr_api.run_query(\r\n url = \"http://mytimbrenv.com:11000\",\r\n ontology = \"my_ontology\",\r\n token = \"tk_mytimbrtoken\",\r\n query = \"SELECT * FROM timbr.sys_concepts\",\r\n datasource = \"my_datasource\",\r\n nested = \"false\",\r\n verify_ssl = False,\r\n enable_IPv6 = False,\r\n is_jwt = True,\r\n jwt_tenant_id = \"my_tenant_id\",\r\n )\r\n print(response)\r\n```\r\n\r\n#### HTTPS example\r\n```python\r\n response = pytimbr_api.run_query(\r\n url = \"https://mytimbrenv.com:11000\",\r\n ontology = \"my_ontology\",\r\n token = \"tk_mytimbrtoken\",\r\n query = \"SELECT * FROM timbr.sys_concepts\",\r\n datasource = \"my_datasource\",\r\n nested = \"false\",\r\n verify_ssl = True,\r\n enable_IPv6 = False,\r\n is_jwt = True,\r\n jwt_tenant_id = \"my_tenant_id\",\r\n )\r\n print(response)\r\n```\r\n",
"bugtrack_url": null,
"license": null,
"summary": "Timbr REST API connector",
"version": "1.0.10",
"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.10.tar.gz",
"Homepage": "https://github.com/WPSemantix/timbr_python_http",
"Repository": "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": null,
"digests": {
"blake2b_256": "ab1069fe14e71e5c8ffc1b04afa0dbc1e269d7e953db5259ae15eef8d3bbf00c",
"md5": "b63d41e11274685ddf2584d4859000d3",
"sha256": "ee63768db8b822a682179639671e7f32adf4f3ef91e96392ac7f1f3b5057fd4b"
},
"downloads": -1,
"filename": "pytimbr_api-1.0.10-py3-none-any.whl",
"has_sig": false,
"md5_digest": "b63d41e11274685ddf2584d4859000d3",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 5287,
"upload_time": "2025-07-29T12:49:40",
"upload_time_iso_8601": "2025-07-29T12:49:40.354815Z",
"url": "https://files.pythonhosted.org/packages/ab/10/69fe14e71e5c8ffc1b04afa0dbc1e269d7e953db5259ae15eef8d3bbf00c/pytimbr_api-1.0.10-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "d19cfdb6d80c7e06f0be0dc7231fb91b5d120b52011c9cefe237320e0129bb04",
"md5": "bbf7e8a719bc70dc517e52c5000a35f4",
"sha256": "965966ef003e73e0b780c3ab9e142a421c72494bae14f1c039561ddb424d28da"
},
"downloads": -1,
"filename": "pytimbr_api-1.0.10.tar.gz",
"has_sig": false,
"md5_digest": "bbf7e8a719bc70dc517e52c5000a35f4",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 6836,
"upload_time": "2025-07-29T12:49:41",
"upload_time_iso_8601": "2025-07-29T12:49:41.603291Z",
"url": "https://files.pythonhosted.org/packages/d1/9c/fdb6d80c7e06f0be0dc7231fb91b5d120b52011c9cefe237320e0129bb04/pytimbr_api-1.0.10.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-07-29 12:49:41",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "WPSemantix",
"github_project": "timbr_python_http",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [],
"lcname": "pytimbr-api"
}