Changed try/except block to if/else for dynamic import of url methods