Agent: Extract API URL to variable EVENTS_API_URL in send_all_events_to_island.py

This commit is contained in:
Shreya Malviya 2022-09-13 17:51:10 +05:30
parent 39f8bafd46
commit 239b2e2550
1 changed files with 2 additions and 1 deletions

View File

@ -17,6 +17,7 @@ logger = logging.getLogger(__name__)
DEFAULT_TIME_PERIOD = 5 DEFAULT_TIME_PERIOD = 5
WAKES_PER_PERIOD = 4 WAKES_PER_PERIOD = 4
EVENTS_API_URL = "https://%s/api/events"
class send_all_events_to_island: class send_all_events_to_island:
@ -89,7 +90,7 @@ class send_all_events_to_island:
for serialized_event in self._event_batch: for serialized_event in self._event_batch:
try: try:
requests.post( # noqa: DUO123 requests.post( # noqa: DUO123
"https://%s/api/events" % (self._server_address,), EVENTS_API_URL % (self._server_address,),
data=serialized_event, data=serialized_event,
headers={"content-type": "application/json"}, headers={"content-type": "application/json"},
verify=False, verify=False,