percent-encoding

Python percent encoding only certain characters in a URL

Python percent encoding only certain characters in a URL Question: I have to percent encode only # character if it appears in a given url. I know that we can encode a URL using urllib.quote. It takes a safe keyword to set a particular character to be safe for the URL. I am looking for …

Total answers: 2

How to prevent python requests from percent encoding my URLs?

How to prevent python requests from percent encoding my URLs? Question: I’m trying to GET an URL of the following format using requests.get() in python: http://api.example.com/export/?format=json&key=site:dummy+type:example+group:wheel #!/usr/local/bin/python import requests print(requests.__versiom__) url = ‘http://api.example.com/export/’ payload = {‘format’: ‘json’, ‘key’: ‘site:dummy+type:example+group:wheel’} r = requests.get(url, params=payload) print(r.url) However, the URL gets percent encoded and I don’t get the …

Total answers: 6