@@ -481,17 +481,17 @@ def make_call(self, path, body=None, delete=False):
481
481
:param body: (optional) list of dictionaries to be serialized into the request body
482
482
:return: the requests.result object (on 200 response), raise error otherwise
483
483
"""
484
+ extra_headers = {"X-Request-Id" : f"{ self .uuid } { int (datetime .now ().timestamp ()* 1000 )} " }
485
+ # if the sync_started or sync_ended flags are set, send a header for any type of call
486
+ if self .sync_started :
487
+ self .logger .info ("Sending start_sync signal" )
488
+ extra_headers ['Pragma' ] = 'umapi-sync-start'
489
+ self .sync_started = False
490
+ elif self .sync_ended :
491
+ self .logger .info ("Sending end_sync signal" )
492
+ extra_headers ['Pragma' ] = 'umapi-sync-end'
493
+ self .sync_ended = False
484
494
if body :
485
- extra_headers = {"X-Request-Id" : f"{ self .uuid } { int (datetime .now ().timestamp ()* 1000 )} " }
486
- # if the sync_started or sync_ended flags are set, send a header on this POST
487
- if self .sync_started :
488
- self .logger .info ("Sending start_sync signal" )
489
- extra_headers ['Pragma' ] = 'umapi-sync-start'
490
- self .sync_started = False
491
- elif self .sync_ended :
492
- self .logger .info ("Sending end_sync signal" )
493
- extra_headers ['Pragma' ] = 'umapi-sync-end'
494
- self .sync_ended = False
495
495
request_body = json .dumps (body )
496
496
def call ():
497
497
return self .session .post (self .endpoint + path , auth = self .auth , data = request_body , timeout = self .timeout ,
0 commit comments