diff --git a/apps/fyle/helpers.py b/apps/fyle/helpers.py index dac8d74..ba962b9 100644 --- a/apps/fyle/helpers.py +++ b/apps/fyle/helpers.py @@ -25,7 +25,7 @@ def post_request(url, body, refresh_token=None): response = requests.post( url, headers=api_headers, - data=body + data=json.dumps(body) ) if response.status_code in (200, 201): @@ -45,7 +45,7 @@ def get_access_token(refresh_token: str) -> str: 'client_secret': settings.FYLE_CLIENT_SECRET } - return post_request(settings.FYLE_TOKEN_URI, body=json.dumps(api_data))['access_token'] + return post_request(settings.FYLE_TOKEN_URI, body=api_data)['access_token'] def get_cluster_domain(refresh_token: str) -> str: diff --git a/apps/workspaces/tasks.py b/apps/workspaces/tasks.py index c728fe0..2a86b83 100644 --- a/apps/workspaces/tasks.py +++ b/apps/workspaces/tasks.py @@ -165,7 +165,7 @@ def async_update_timestamp_in_qbd_direct(workspace_id: int) -> None: if fyle_creds: refresh_token = fyle_creds.refresh_token - post_request(url=api_url, body=json.dumps(payload), refresh_token=refresh_token) + post_request(url=api_url, body=payload, refresh_token=refresh_token) else: raise Exception('Auth Token not present for workspace id {}'.format(workspace.id)) except Exception as e: diff --git a/tests/test_fyle/test_helpers.py b/tests/test_fyle/test_helpers.py index 66b89b4..3802f55 100644 --- a/tests/test_fyle/test_helpers.py +++ b/tests/test_fyle/test_helpers.py @@ -20,4 +20,4 @@ def __init__(self, text, status_code): 'established': '1990' } mocker.patch('requests.post', return_value=(MockResponse("""{"data": "Airline Posted"}""", 200))) - post_request(url, body=json.dumps(body)) + post_request(url, body=body)