@@ -152,3 +152,35 @@ if __name__ == "__main__":
152152 print (f " ping failed, { error} " )
153153
154154```
155+
156+ Write points using GRPC protocol:
157+
158+ ``` python
159+ from datetime import datetime
160+ from opengemini_client import Client, Config, Address, Point, BatchPoints, Precision
161+ from opengemini_client.models import GrpcConfig
162+
163+ if __name__ == " __main__" :
164+ config = Config(address = [Address(host = ' 127.0.0.1' , port = 8086 )],
165+ grpc_config = GrpcConfig(
166+ address = [Address(host = ' 127.0.0.1' , port = 8305 )],
167+ ))
168+ cli = Client(config)
169+ try :
170+ database = ' test'
171+ measurement = ' test_measurement'
172+ point = Point(
173+ measurement = measurement,
174+ precision = Precision.PrecisionSecond,
175+ fields = {' Humidity' : 87 , ' Temperature' : 25 },
176+ tags = {' Weather' : ' foggy' },
177+ timestamp = datetime.now(),
178+ )
179+ batch_points = BatchPoints(points = [point])
180+ cli.write_by_grpc(database = database, batch_points = batch_points)
181+ print (f " write points success " )
182+ except Exception as error:
183+ print (f " write points failed, { error} " )
184+
185+ ```
186+ ```
0 commit comments