<!-- language-all: lang-py -->
You should call [QgsRasterLayer.triggerRepaint()][1]

If your layer is called myLayer call

    myLayer.triggerRepaint()

The same method exists for vector layers as well.

  [1]: http://www.qgis.org/api/classQgsRasterLayer.html#ad2fabc4fdc3bce56d615b5513767eaa9