File tree Expand file tree Collapse file tree 2 files changed +8
-4
lines changed
Expand file tree Collapse file tree 2 files changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -180,9 +180,12 @@ def send_request(self, data): # noqa: max-complexity: 13
180180 False - retry, keep flush buffer
181181 """
182182 try :
183+ headers = {
184+ 'user-agent' : self .user_agent ,
185+ 'apikey' : self .key
186+ }
183187 response = requests .post (url = self .url ,
184188 json = data ,
185- auth = ('user' , self .key ),
186189 params = {
187190 'hostname' : self .hostname ,
188191 'ip' : self .ip ,
@@ -193,7 +196,7 @@ def send_request(self, data): # noqa: max-complexity: 13
193196 stream = True ,
194197 allow_redirects = True ,
195198 timeout = self .request_timeout ,
196- headers = { 'user-agent' : self . user_agent } )
199+ headers = headers )
197200
198201 status_code = response .status_code
199202 '''
Original file line number Diff line number Diff line change @@ -153,7 +153,6 @@ def test_try_lock_and_do_flush_request(self):
153153 'e' : 'ls' ,
154154 'ls' : test_buf
155155 },
156- auth = ('user' , self .handler .key ),
157156 params = {
158157 'hostname' : self .handler .hostname ,
159158 'ip' : self .handler .ip ,
@@ -164,7 +163,9 @@ def test_try_lock_and_do_flush_request(self):
164163 stream = True ,
165164 allow_redirects = True ,
166165 timeout = self .handler .request_timeout ,
167- headers = {'user-agent' : self .handler .user_agent })
166+ headers = {
167+ 'user-agent' : self .handler .user_agent ,
168+ 'apikey' : LOGDNA_API_KEY })
168169 self .assertTrue (post_mock .call_count , 1 )
169170
170171 @mock .patch ('time.time' , unittest .mock .MagicMock (return_value = now ))
You can’t perform that action at this time.
0 commit comments