Get port/key from the window properties

This is cleaner and will allow the python activity to
set them up for every pages, not just the first loaded one.