Skip to content

avoid storing atributes on __class__

mathause requested to merge mathause/ethz-iam-webservice:avoid_class into main

This merge request stores _admin_username and _admin_password directly on the instance. With the current implementation I have problems when sending requests in parallel. Also _admin_username is available on the instance anyway:

from ethz_iam_webservice.user import UserService

user_service = UserService("username", "password")
user_service._admin_username

Full example

from ethz_iam_webservice.user import UserService
from joblib import Parallel, delayed

user_service = UserService("username", "password")

members = ["mathause"]

users = Parallel(n_jobs=8)(delayed(user_service.get_user)(member) for member in members)
AttributeError: 'UserService' object has no attribute '_admin_username'

Merge request reports

Loading