make sure shurl is defined in advance

UnboundLocalError: local variable 'shurl' referenced before assignment