From 4e87c3068af1231a1c9f9ef2ebec9ad6c4b82d14 Mon Sep 17 00:00:00 2001 From: Remy van der Wereld Date: Tue, 17 Dec 2024 14:23:09 +0100 Subject: [PATCH] fix: rename obo_acces_stoken to obo_access_token for consistency --- app/apps/addresses/views.py | 4 ++-- app/utils/api_queries_brp.py | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/app/apps/addresses/views.py b/app/apps/addresses/views.py index 6e4581e49..e5ff6e043 100644 --- a/app/apps/addresses/views.py +++ b/app/apps/addresses/views.py @@ -81,9 +81,9 @@ def residents_by_bag_id(self, request, bag_id): # nummeraanduiding_id should have been retrieved, so get BRP data if address.nummeraanduiding_id: try: - obo_acces_stoken = request.data.get("obo_acces_stoken") + obo_access_token = request.data.get("obo_access_token") brp_data, status_code = get_brp_by_nummeraanduiding_id( - request, address.nummeraanduiding_id, obo_acces_stoken + request, address.nummeraanduiding_id, obo_access_token ) serialized_residents = ResidentsSerializer(data=brp_data) serialized_residents.is_valid(raise_exception=True) diff --git a/app/utils/api_queries_brp.py b/app/utils/api_queries_brp.py index 9de7661a2..8e43d644b 100644 --- a/app/utils/api_queries_brp.py +++ b/app/utils/api_queries_brp.py @@ -8,7 +8,7 @@ logger = logging.getLogger(__name__) -def get_brp_by_nummeraanduiding_id(request, nummeraanduiding_id, obo_acces_stoken): +def get_brp_by_nummeraanduiding_id(request, nummeraanduiding_id, obo_access_token): """Returns BRP data by bag_""" queryParams = { @@ -16,7 +16,7 @@ def get_brp_by_nummeraanduiding_id(request, nummeraanduiding_id, obo_acces_stoke "inclusiefoverledenpersonen": "true", "expand": "partners,ouders,kinderen", } - return get_brp(queryParams, obo_acces_stoken) + return get_brp(queryParams, obo_access_token) def get_brp_by_address(request, postal_code, number, suffix, suffix_letter): @@ -44,10 +44,10 @@ def get_brp_by_address(request, postal_code, number, suffix, suffix_letter): @retry(stop=stop_after_attempt(3)) -def get_brp(queryParams, obo_acces_stoken): +def get_brp(queryParams, obo_access_token): """Returns BRP data""" url = f"{settings.BRP_API_URL}" - brp_access_token = get_brp_access_token(obo_acces_stoken) + brp_access_token = get_brp_access_token(obo_access_token) response = requests.get( url, params=queryParams, @@ -63,13 +63,13 @@ def get_brp(queryParams, obo_acces_stoken): return response.json(), response.status_code -def get_brp_access_token(obo_acces_stoken): +def get_brp_access_token(obo_access_token): url = settings.OIDC_OP_TOKEN_ENDPOINT payload = { "grant_type": "urn:ietf:params:oauth:grant-type:jwt-bearer", "client_id": settings.BRP_CLIENT_ID, "client_secret": settings.BRP_CLIENT_SECRET, - "assertion": obo_acces_stoken, + "assertion": obo_access_token, "scope": f"{settings.BRP_CLIENT_ID}/.default", "requested_token_use": "on_behalf_of", }