Moving parse uri outside connect try/except