Skip to content

Commit 87683f4

Browse files
Linux-oiDaviau
authored andcommitted
Add method close to InfluxDBClient class. (influxdata#465)
* Add method close to InfluxDBClient class. This method just closes Session if it's exist. * Add method close to InfluxDBClient class. This method just closes Session if it's exist.
1 parent 795907d commit 87683f4

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

influxdb/client.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -823,6 +823,11 @@ def send_packet(self, packet, protocol='json'):
823823
data = ('\n'.join(packet) + '\n').encode('utf-8')
824824
self.udp_socket.sendto(data, (self._host, self.udp_port))
825825

826+
def close(self):
827+
"""Close http session."""
828+
if isinstance(self._session, requests.Session):
829+
self._session.close()
830+
826831

827832
def _parse_dsn(dsn):
828833
"""Parse data source name.

0 commit comments

Comments
 (0)