corrected content type
This commit was merged in pull request #51.
This commit is contained in:
+4
-2
@@ -17,9 +17,11 @@ def get_headers():
|
|||||||
}
|
}
|
||||||
logger.info(f"Calling Bank Call Auth endpoint: {url}")
|
logger.info(f"Calling Bank Call Auth endpoint: {url}")
|
||||||
logger.info(f"Calling Bank Call Auth endpoint with data: {data}")
|
logger.info(f"Calling Bank Call Auth endpoint with data: {data}")
|
||||||
|
|
||||||
|
headers = {"Content-Type": "application/json"}
|
||||||
|
|
||||||
try:
|
try:
|
||||||
response = requests.post(url, data=data, timeout=10)
|
response = requests.post(url, json=data, headers=headers, timeout=10)
|
||||||
response.raise_for_status() # Raises HTTPError for 4xx/5xx
|
response.raise_for_status() # Raises HTTPError for 4xx/5xx
|
||||||
result = response.json()
|
result = response.json()
|
||||||
|
|
||||||
@@ -34,7 +36,7 @@ def get_headers():
|
|||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
"x-api-key": settings.BANK_CALL_API_KEY,
|
"x-api-key": settings.BANK_CALL_API_KEY,
|
||||||
"App-Id": settings.BANK_CALL_APP_ID,
|
"App-Id": settings.BANK_CALL_APP_ID,
|
||||||
"Authorization": result['access_token']
|
"Authorization": f"Bearer {result['access_token']}"
|
||||||
}
|
}
|
||||||
|
|
||||||
except requests.exceptions.RequestException as e:
|
except requests.exceptions.RequestException as e:
|
||||||
|
|||||||
Reference in New Issue
Block a user