Skip to main content

Timbr REST API Python connector

This is the sample for connecting to Timbr using REST API from Python.


Dependencies

  • Python 3.7.13+ or 3.8.x or 3.9.x

Installation


Sample usage

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

Executing query with http connection

 # For http connections
response = pytimbr_api.executeQuery(hostname='<TIMBR_IP/HOST>', port='<TIMBR_PORT>', ontology='<ONTOLOGY_NAME>', token='<USER_TOKEN>', query='<TIMBR_QUERY>', nested='<true/false>')

# hostname - The IP / Hostname of the Timbr platform.
# port - Timbr default port 443
# ontology - the ontology / knowledge graph to connect to.
# token - Timbr token value.
# query - The query that you want to execute.
# nested - Change to true if nested flag needs to be enabled.

print(response)

Executing query with https connection

 # For http connections
response = pytimbr_api.securedExecuteQuery(hostname='<TIMBR_IP/HOST>', port='<TIMBR_PORT>', ontology='<ONTOLOGY_NAME>', token='<USER_TOKEN>', query='<TIMBR_QUERY>', nested='<true/false>')

# hostname - The IP / Hostname of the Timbr platform.
# port - Timbr default port 443
# ontology - the ontology / knowledge graph to connect to.
# token - Timbr token value.
# query - The query that you want to execute.
# nested - Change to true if nested flag needs to be enabled.

print(response)