2π
In a URL, what travels after # is known as hash. In an HTTP request that reaches a server (server side) this data does not travel to the server. Therefore, on the server side, it is not possible to retrieve it (web browsers do not send this data in the HTTP request).
However, on the client side it is possible. In Javascript you could do:
window. location. hash
0π
dont try to parse urls manually β use the stdlib urllib.parse.urlparse
function (urlparse.urlparse
on python2):
from urllib.parse import urlparse # from urlparse import urlparse on py2
scheme = urlparse('http://localhost/addAccount/#code=qwerty')
print(scheme.fragment)
prints out:
code=qwerty
Unfortunately you cannot get from the server-side the fragement of the url (data after the #). AFAIK all browsers wont send the fragement to the server (the fragement can be used only on client side code (e.g. javascript).
Quoting Wikipedia:
When an agent (such as a Web browser) requests a web resource from a Web server, the agent sends the URI to the server, but does not send the fragment. Instead, the agent waits for the server to send the resource, and then the agent processes the resource according to the document type and fragment value.[2]
- [Django]-Sharing Django user model between two apps in the same project
- [Django]-TinyMCE popups not loading when using S3 and setting document.domain