Question
How do I force requests to make HTTPS requests, even if the URL is given as 'http://...'?
Related questions
There are questions similar in title such as this one but they're not quite answering my question.
I also looked into the verify argument (link to question), but again I'm not quite sure if just setting it to True solves the issue.
Attempt
My current code just runs any URL through an assert_https function before handing it to requests.
from urllib.parse import urlparse
def assert_https(url: str) -> str:
components = urlparse(url)
components = components._replace(scheme='https')
return components.geturl()