[sysadmin-bin] TypeError: Object of type bytes is not JSON serializable



commit 17259c24945d14c320bda50ce64504240f3f2186
Author: Andrea Veri <averi redhat com>
Date:   Thu Nov 12 19:42:02 2020 +0100

    TypeError: Object of type bytes is not JSON serializable

 gitlab/gitlab-operations.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/gitlab/gitlab-operations.py b/gitlab/gitlab-operations.py
index c29b92e..35a1e61 100755
--- a/gitlab/gitlab-operations.py
+++ b/gitlab/gitlab-operations.py
@@ -48,7 +48,7 @@ for username, id in ldapusers_dict.items():
     if ssh_key is not None:
         user = gl.users.get(id)
         try:
-            user.keys.create({'title': 'Imported from account.gnome.org', 'key': ssh_key})
+            user.keys.create({'title': 'Imported from account.gnome.org', 'key': ssh_key.decode('utf-8')})
 
             print(f"Key for username { username } with id { id } has been added")
         except gitlab.exceptions.GitlabCreateError as e:


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]