def stripApiAndVersionFromURL(url): # remove the slash (if any) at the beginning of the url if url[0] == '/': url = url[1:] urlElements = url.split('/') if 'api' in url: # strip the api/v0 part of the url urlElements = urlElements[2:] return '/'.join(urlElements)