Skip to content

Commit

Permalink
fix: get access token (#125)
Browse files Browse the repository at this point in the history
Co-authored-by: GitHub Actions <[email protected]>
  • Loading branch information
ruuushhh and GitHub Actions committed Jan 31, 2025
1 parent 427bd54 commit 57c525c
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions apps/fyle/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion apps/workspaces/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion tests/test_fyle/test_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

0 comments on commit 57c525c

Please sign in to comment.