Skip to content

Commit 3f557cd

Browse files
committed
Keep connections open via requests.Session
1 parent b9688e6 commit 3f557cd

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

logtail/uploader.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,12 @@ class Uploader(object):
88
def __init__(self, source_token, host):
99
self.source_token = source_token
1010
self.host = host
11+
self.session = requests.Session()
1112
self.headers = {
1213
'Authorization': 'Bearer %s' % source_token,
1314
'Content-Type': 'application/msgpack',
1415
}
1516

1617
def __call__(self, frame):
1718
data = msgpack.packb(frame, use_bin_type=True)
18-
return requests.post(self.host, data=data, headers=self.headers)
19+
return self.session.post(self.host, data=data, headers=self.headers)

0 commit comments

Comments
 (0)