pytoolbox.network.url module¶
- pytoolbox.network.url.with_subdomain(url, subdomain=None)[source]¶
Return the
url
with the sub-domain replaced withsubdomain
.Example usage
>>> from pytoolbox.unittest import asserts >>> eq = asserts.equal >>> asserts.equal( ... with_subdomain('http://app.website.com/page'), ... 'http://website.com/page') >>> asserts.equal( ... with_subdomain('http://app.website.com/page', 'help'), ... 'http://help.website.com/page') >>> asserts.equal( ... with_subdomain('https://app.website.com#d?page=1', 'help'), ... 'https://help.website.com#d?page=1')