在我的Django應用中,我需要從引薦來源網址中獲取主機名request.META.get('HTTP_REFERER')及其協議,以便從類似以下網址的網址中獲?。篽ttps://docs.google.com/spreadsheet/ccc?key=blah-blah-blah-blah#gid=1https://stackoverflow.com/questions/1234567/blah-blah-blah-blahhttp://www.example.comhttps://www.other-domain.com/whatever/blah/blah/?v1=0&v2=blah+blah ...我應該得到:https://docs.google.com/https://stackoverflow.com/http://www.example.comhttps://www.other-domain.com/我查看了其他相關問題,并找到了有關urlparse的信息,但這并沒有解決問題,因為>>> urlparse(request.META.get('HTTP_REFERER')).hostname'docs.google.com'
添加回答
舉報
0/150
提交
取消