'datetime.time' has no attribute 'localtime' code example
Example: datetime has no attribute now
#You probably have
import datetime
#change that to
from datetime import datetime
#You probably have
import datetime
#change that to
from datetime import datetime