TDengine/docs/examples/python/connect_example.py

22 lines
424 B
Python
Raw Normal View History

import taos
2024-08-01 13:07:55 +00:00
def create_connection():
# all parameters are optional.
2024-08-01 13:07:55 +00:00
conn = None
try:
conn = taosws.connect(
user="root",
password="taosdata",
host="192.168.1.98",
port=6041,
)
except Exception as err:
print(f'Exception {err}')
finally:
if conn:
conn.close()
if __name__ == "__main__":
2024-08-01 13:07:55 +00:00
create_connection()