How to get input from mouse(with python)?

Hello, i tried the same code one uses to get keyboard inputs to get the mouse input in my game:

	def mouseUpdate(self):
		for button, status in self.mouse.events:
			if status == logic.KX_INPUT_JUST_ACTIVATED:
				if button == events.LEFTBUTTON:
                                           (DO THINGS...)

But console tells me which:

TypeError: 'int' object is not iterable

So how can I do the code above work for what I intend it to? Also if there is a python way(without the sensor) for both that and a keyboard input please let me know.

Thanks for any help

With mouse_sensor.getButtonStatus(bge.events.LEFTMOUSE) you only get one integer value back which is representing the actual status of the mouse button.
You don’t get a list with button and status like the keyboard sensor.

This is the solution for both questions.
You only need a always sensor with enabled true pulse.
keyboard = bge.logic.keyboard
mouse = bge.logic.mouse

Here is how it worked for me(for both keyboard and mouse):

if self.mouse.events[events.LEFTMOUSE] == logic.KX_INPUT_JUST_ACTIVATED:
                          (DO STUFF)
          if self.mouse.events[events.RIGHTMOUSE] == logic.KX_INPUT_JUST_ACTIVATED:
                          (DO STUFF)
                                (AND SO ON....)

Thanks again for the help HG1

Sorry, my code was wrong before(it was checking for any kind of input in all keys), the right version is above, telling which key you want to get the logic state.