Search code examples
pythoncherrypy

How to know the origin url in cherrypy?


How do you get the baseurl in cherrypy? I see a cherrypy.url() which gives me the entire url "http://mywebaddress.com/currentpage"

Is there some similar function in cherrypy that allows me to just get the "http://mywebaddress.com"/"http://mywebaddress.com/" part regardless of the route I am on?


Solution

  • Check out urlparse. This will let you parse the URL into its components.