user3264316
user3264316

Reputation: 332

Hashtag not recognized in url request

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

Upvotes: 0

Views: 3931

Answers (1)

Rejected
Rejected

Reputation: 4491

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"

Upvotes: 4

Related Questions