요청을 서버로 보냈습니다 referer url을 가져오고 싶습니다. appengine에서 webapp2 프레임 워크를 사용하고 있습니다.게시 요청에 대한 referer url을 python/webapp2에서 가져옵니다.
내가 수행 할 때
def post(self, slug):
print self.request
나는 다음과 같은 출력을 얻을 :
OST /first/person/ HTTP/1.0 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3 Accept-Language: en-US,en;q=0.8 Cache-Control: max-age=0 Connection: keep-alive Content-Length: 43 Content-Type: application/x-www-form-urlencoded Content_Length: 43 Content_Type: application/x-www-form-urlencoded Cookie: djdt=hide; csrftoken=09f29b2bfe9f51f16581bab7fe7c6f38; sessionid=49b995d954eae8d613cedc3f4e92a796 Host: 127.0.0.1:8080 Origin: http://127.0.0.1:8080 Referer: http://127.0.0.1:8080/person/1/
명확하게 볼 수 있습니다로 난 단지 리퍼러에 관심이 Referer: http://127.0.0.1:8080/person/1/
이 때문에 내가 시도 :
referer = self.request.headers['Referer']
print referer
출력을 제공
: 요청에 문자열 처리를 할 것 얻기의
False Status: 200 Content-Type: text/html; charset=utf-8 Content-Length: 0 Cache-Control: no-cache
한 가지 방법,하지만 난 뭔가 더 표준이있을 것입니다 확신합니다. 귀하의 코멘트에서 언급 한 바와 같이
는
'Referer' 헤더는'self.request.referer' 속성으로도 액세스 할 수 있습니다. –
도 반환 : * 거짓 상태 : 200 Content-Type : text/html; charset = utf-8 Content-Length : 0 Cache-Control : no-cache * – user993563