| Server IP : 104.21.37.246 / Your IP : 172.71.28.145 [ Web Server : Apache System : Linux cpanel01wh.bkk1.cloud.z.com 2.6.32-954.3.5.lve1.4.59.el6.x86_64 #1 SMP Thu Dec 6 05:11:00 EST 2018 x86_64 User : cp648411 ( 1354) PHP Version : 7.2.34 Disable Function : NONE Domains : 0 Domains MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /proc/2388322/root/opt/alt/python37/lib/python3.7/site-packages/wmt/common/ |
Upload File : |
from urllib.parse import urlparse, ParseResult
def parse(domain: str, scheme: str = 'http') -> str:
"""
Convert domain name to 'http://www.domain.com' format
"""
# https://stackoverflow.com/questions/21659044/how-can-i-prepend-http-to-a-url-if-it-doesnt-begin-with-http
p = urlparse(domain, 'http')
netloc = p.netloc or p.path
path = p.path if p.netloc else ''
p = ParseResult(p.scheme, netloc, path, *p[3:])
return p.geturl()