Reputation: 174
So:
from urllib.parse import urljoin
urljoin('https://abc.info', '?scurr=EUR&page=')
Result:
'https://abc.info?scurr=EUR&page='
Expected result:
'https://abc.info/?scurr=EUR&page='
How can I make it?
Upvotes: 1
Views: 345
Reputation: 13067
urllib
is doing the right thing. The trailing slash (or lack thereof) is significant and those are technically different routes. It is often the case that one would rewrite them and/or handle them as though they were the same for SEO reasons.
In your example, the trailing slash is important so add it to the base URL:
urljoin('https://abc.info/', '?scurr=EUR&page=')
gives us:
https://abc.info/?scurr=EUR&page=
Upvotes: 2