1

Hello I want to make a get request and have a URL that contains

url = "http://example.com/tags/feature%252Fexample/site/"

however if I do a get it changes the URL to a slash and yields an error.

requests.get(url)
equests.exceptions.HTTPError: 400 Client Error: Bad Request for url:
http://example.com/tags/feature/example/site/

Is there a way to keep the url how it is without the / ? I found this question but it is the other way around.. How to prevent python requests from percent encoding my URLs? and was not able to find an option in the documentation.

Thank you.

Ben
  • 309
  • 1
  • 14
  • Just to be sure. You mean `feature%2Fexample` without the extra `25`, right? – Giacomo Catenazzi Mar 20 '19 at 14:59
  • I tested on my web server, and `requests` is doing the correct request to the server. It just display the "unescaped" URL. I think you are double escape (so the %25). – Giacomo Catenazzi Mar 20 '19 at 15:12
  • The string should stay exactly as given with `feature%252Fexample` – Ben Mar 21 '19 at 06:12
  • 1
    I tried also that with my webserver, and `requests` will request the right url (so still with %252F in the URL). On Python3. What `requests` print (the "URL") is not what it was really requested. – Giacomo Catenazzi Mar 21 '19 at 06:50

0 Answers0