At some point, I need to view the history on a specific topic 'topicName'. How can i do this in python?
Short answer: You don't
(The MQTT protocol requires the broker to only stores messages for known clients that are currently offline and have requested high QOS subscription, otherwise it doesn't keep any state, and client libraries won't keep history for you)
Longer answer:
The only way to see the history of messages published to a topic is to set a client up to subscribe to that topic and store them somewhere (e.g. in a database) and then query that store. (Some brokers have plugin support that can do this)
How view history by topic in paho-mqtt?