ChandimaPrabath commited on
Commit
ff78474
1 Parent(s): 3fb8e72
Files changed (1) hide show
  1. api.py +3 -1
api.py CHANGED
@@ -1,5 +1,6 @@
1
  import requests
2
  import logging
 
3
 
4
  class LoadBalancerAPI:
5
  def __init__(self, base_url):
@@ -12,7 +13,8 @@ class LoadBalancerAPI:
12
  api_endpoint = f'{self.base_url}/api/register'
13
 
14
  try:
15
- response = requests.post(api_endpoint, data=data)
 
16
  response.raise_for_status()
17
  return response.json() # Assuming the API returns JSON
18
  except requests.exceptions.RequestException as e:
 
1
  import requests
2
  import logging
3
+ import json
4
 
5
  class LoadBalancerAPI:
6
  def __init__(self, base_url):
 
13
  api_endpoint = f'{self.base_url}/api/register'
14
 
15
  try:
16
+ headers = {'Content-Type': 'application/json'}
17
+ response = requests.post(api_endpoint, data=json.dumps(data), headers=headers)
18
  response.raise_for_status()
19
  return response.json() # Assuming the API returns JSON
20
  except requests.exceptions.RequestException as e: