def handle_tool_shed_url_protocol(app, shed_url):
 try:
  if (app.name == 'galaxy'):
   url = remove_protocol_from_tool_shed_url(shed_url)
   tool_shed_url = get_tool_shed_url_from_tool_shed_registry(app, url)
  else:
   tool_shed_url = str(url_for('/', qualified=True)).rstrip('/')
  return tool_shed_url
 except Exception as e:
  if (shed_url is not None):
   log.exception('Handled exception removing protocol from URL %s:\n%s', str(shed_url), e)
  return shed_url

def handle_tool_shed_url_protocol ( app , shed_url ) : try : if ( app . name == 'galaxy' ) : url = remove_protocol_from_tool_shed_url ( shed_url ) tool_shed_url = get_tool_shed_url_from_tool_shed_registry ( app , url ) else : tool_shed_url = str ( url_for ( '/' , qualified = True ) ) . rstrip ( '/' ) return tool_shed_url except Exception as e : if ( shed_url is not None ) : log . exception ( 'Handled exception removing protocol from URL %s:\n%s' , str ( shed_url ) , e ) return shed_url
handle secure and insecure http protocol since they may change over time .