Your Pi can use it as a dumb dc motor, but when you need closed loop control, you have to read channel A+B as a “quadrature encoder”. It’s best to use interupt-routines for that part. Otherwise you might miss a signal or two.
I’m not sure, if python is good in interupts?
I’ve only written a code that treats these geared encoder motors like a stepper-motor for an Atmega-chip.