Skip to content

Commit 3ba27ff

Browse files
committed
fix: update user's bool data and avatar
If we want to update email, avatar and do not send email confirmation change (`skip_reconfirmation` = True), `MultipartEncoder` will try to encode everything except None and bytes. So it tries to encode bools. Casting bool's values to their stringified int representation fix it.
1 parent 60c5fd8 commit 3ba27ff

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

gitlab/client.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -505,6 +505,12 @@ def http_request(
505505
json = None
506506
if post_data is None:
507507
post_data = {}
508+
else:
509+
# booleans does not exists for data (neither for MultipartEncoder):
510+
# cast to string int to avoid: 'bool' object has no attribute 'encode'
511+
for k, v in post_data.items():
512+
if isinstance(v, bool):
513+
post_data[k] = str(int(v))
508514
post_data["file"] = files.get("file")
509515
post_data["avatar"] = files.get("avatar")
510516
data = MultipartEncoder(post_data)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy