If get_expiration is called and addomain is not imported, an AttributeError is raised:
Python 3.7.3 (v3.7.3:ef4ec6ed12, Mar 25 2019, 22:22:05) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
from pyad import aduser
aduser.ADUser.from_cn('xxxx').get_expiration()
Traceback (most recent call last):
File "", line 1, in
File "C:\Local\Software\Python37\lib\site-packages\pyad\aduser.py", line 55, in get_expiration
return self.get_password_last_set() + self.get_max_pwd_age()
File "C:\Local\Software\Python37\lib\site-packages\pyad\aduser.py", line 41, in get_max_pwd_age
return pyadutils.convert_timespan(self.get_domain().maxPwdAge)
File "C:\Local\Software\Python37\lib\site-packages\pyad\adobject.py", line 202, in getattr
raise AttributeError(attribute)
AttributeError: get_domain
from pyad import addomain
aduser.ADUser.from_cn('xxxx').get_expiration()
datetime.datetime(2019, 10, 6, 7, 3, 36)
If get_expiration is called and addomain is not imported, an AttributeError is raised:
Python 3.7.3 (v3.7.3:ef4ec6ed12, Mar 25 2019, 22:22:05) [MSC v.1916 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information. from pyad import aduser aduser.ADUser.from_cn('xxxx').get_expiration() Traceback (most recent call last): File "", line 1, in
File "C:\Local\Software\Python37\lib\site-packages\pyad\aduser.py", line 55, in get_expiration
return self.get_password_last_set() + self.get_max_pwd_age()
File "C:\Local\Software\Python37\lib\site-packages\pyad\aduser.py", line 41, in get_max_pwd_age
return pyadutils.convert_timespan(self.get_domain().maxPwdAge)
File "C:\Local\Software\Python37\lib\site-packages\pyad\adobject.py", line 202, in getattr
raise AttributeError(attribute)
AttributeError: get_domain
from pyad import addomain
aduser.ADUser.from_cn('xxxx').get_expiration()
datetime.datetime(2019, 10, 6, 7, 3, 36)