Skip to content

Commit 6ab9359

Browse files
Move decamelization to global level
1 parent 24d5079 commit 6ab9359

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

authsignal/client.py

+9-9
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def send(self, request, **kwargs):
5757
data = response.json()
5858
if isinstance(data, dict) and 'actionCode' in data:
5959
del data['actionCode']
60-
response._content = json.dumps(data).encode('utf-8')
60+
response._content = json.dumps(humps.decamelize(data)).encode('utf-8')
6161
except json.JSONDecodeError:
6262
pass
6363
return response
@@ -121,7 +121,7 @@ def track(self, user_id, action, payload=None, path=None):
121121
params=params)
122122
response.raise_for_status()
123123

124-
return humps.decamelize(response.json())
124+
return response.json()
125125
except requests.exceptions.RequestException as e:
126126
raise ApiException(str(e), path) from e
127127

@@ -151,7 +151,7 @@ def get_action(self, user_id, action, idempotency_key, path=None):
151151
params=params)
152152
response.raise_for_status()
153153

154-
return humps.decamelize(response.json())
154+
return response.json()
155155
except requests.exceptions.RequestException as e:
156156
raise ApiException(str(e), path) from e
157157

@@ -183,7 +183,7 @@ def get_user(self, user_id, redirect_url=None, path=None):
183183
params=params)
184184
response.raise_for_status()
185185

186-
return humps.decamelize(response.json())
186+
return response.json()
187187
except requests.exceptions.RequestException as e:
188188
raise ApiException(str(e), path) from e
189189

@@ -201,7 +201,7 @@ def delete_user(self, user_id):
201201
timeout=self.timeout
202202
)
203203
response.raise_for_status()
204-
return humps.decamelize(response.json())
204+
return response.json()
205205
except requests.exceptions.RequestException as e:
206206
raise ApiException(str(e), path) from e
207207

@@ -222,7 +222,7 @@ def delete_authenticator(self, user_id: str, user_authenticator_id: str) -> Dict
222222
timeout=self.timeout
223223
)
224224
response.raise_for_status()
225-
return humps.decamelize(response.json())
225+
return response.json()
226226
except requests.exceptions.RequestException as e:
227227
raise ApiException(str(e), path) from e
228228

@@ -241,7 +241,7 @@ def update_user(self, user_id, data):
241241

242242
response.raise_for_status()
243243

244-
return humps.decamelize(response.json())
244+
return response.json()
245245

246246
def enroll_verified_authenticator(self, user_id, authenticator_payload, path=None):
247247
"""Enrols an authenticator like a phone number for SMS on behalf of the user
@@ -268,7 +268,7 @@ def enroll_verified_authenticator(self, user_id, authenticator_payload, path=No
268268
timeout=timeout,
269269
params=params)
270270
response.raise_for_status()
271-
return humps.decamelize(response.json())
271+
return response.json()
272272
except requests.exceptions.RequestException as e:
273273
raise ApiException(str(e), path) from e
274274

@@ -289,7 +289,7 @@ def validate_challenge(self, token: str, user_id: Optional[str] = None, action:
289289
timeout=self.timeout
290290
)
291291

292-
response_data = humps.decamelize(response.json())
292+
response_data = response.json()
293293

294294
return response_data
295295
except requests.exceptions.RequestException as e:

0 commit comments

Comments
 (0)