I am trying to do an url encoding on the following string the following string 'https://bla/ble:bli~' using the urllib standard library on Python 3.10. Problem is that the ~ character is not encoded to %7E as perurl encoding. Is there a way around it?
I have tried
from urllib.parse import quoteinput_string = 'https://bla/ble:bli~'url_encoded = quote(input_string)
url_encoded takes the value 'https%3A//bla/ble%3Abli~'
I have also tried:
url_encoded = quote(input_string,safe='~')
In this case the url_encoded takes the value 'https%3A%2F%2Fbla%2Fble%3Abli~'