I'm using the following Python snippet to get a URL:
address = self.request.url
This gives me the URL when it looks like:
http://domain.tld
or
http://sub.domain.tld
But my URL looks like this:
http://sub.sub.domain.tld
In this case the code doesn't return a URL at all. In the end I have to get the first 'sub' domain from the URL. But I can't continue if the code doesn't work when a URL has two subdomains.
Does anyone have any idea how to solve this issue?