Question

I have the following url:

http://localhost:8000/api/v1/open/?name=/ficheiro#.txt

and I want to get it's information via a GET request (using python's Requests lib). That "/ficheiro#" is the "name" parameter of the object I want to get. What happens is that the url is not recognized and so it returns nothing to the GET request, eventhough such object exists!

Anyone knows what might be going on?

Thanks in advance

Was it helpful?

Solution

Escape the # symbol in urls with an encoded pound symbol (%23). In your case, http://localhost:8000/api/v1/open/?name=/ficheiro%23.txt.

The # character is a special character, called a named anchor, that isn't passed to the server by the browser. In your case (assuming everything else works fine), the browser is requesting the file "/ficheiro", not "/ficheiro#.txt"

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top