python3 doesnt have httplib so wrap it in try except block