From 5474ccf4c8a05628c129a9c8404e0c2cdeb7418d Mon Sep 17 00:00:00 2001 From: Pravash Jha <34673726+pravash21@users.noreply.github.com> Date: Tue, 9 Jun 2020 00:41:51 +0530 Subject: [PATCH] Update Main.py --- Main.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Main.py b/Main.py index 43dd4f0..8ef6abe 100644 --- a/Main.py +++ b/Main.py @@ -14,7 +14,19 @@ img_dir = './static/img/' pdf_dir = './static/pdf/' +def convert_url(url): + if url.startswith('https://www.'): + return 'https://' + url[len('https://www.'):] + if url.startswith('http://www.'): + return 'http://' + url[len('http://www.'):] + if url.startswith('www.'): + return 'https://' + url + if not url.startswith('https://'): + return 'https://' + url + return url + def url_check(url): + url = convert_url(url) valid = validators.url(url) if valid == True: try: