Skip to content

Commit 651062a

Browse files
Merge pull request #2261 from VWS-Python/more-common-bytes
Use more common way of encoding bytes - for readability
2 parents 31f4a8b + 5543b81 commit 651062a

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/vws/vws.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,9 @@ def add_target(
293293
rate limiting access.
294294
"""
295295
image_data = _get_image_data(image=image)
296-
image_data_encoded = base64.b64encode(image_data).decode("ascii")
296+
image_data_encoded = base64.b64encode(s=image_data).decode(
297+
encoding="ascii",
298+
)
297299

298300
data = {
299301
"name": name,
@@ -303,7 +305,7 @@ def add_target(
303305
"application_metadata": application_metadata,
304306
}
305307

306-
content = bytes(json.dumps(data), encoding="utf-8")
308+
content = json.dumps(obj=data).encode(encoding="utf-8")
307309

308310
response = self._make_request(
309311
method=HTTPMethod.POST,
@@ -687,7 +689,7 @@ def update_target(
687689
if application_metadata is not None:
688690
data["application_metadata"] = application_metadata
689691

690-
content = bytes(json.dumps(data), encoding="utf-8")
692+
content = json.dumps(obj=data).encode(encoding="utf-8")
691693

692694
self._make_request(
693695
method=HTTPMethod.PUT,

0 commit comments

Comments
 (0)