http.HttpRequest.get_full_path()

HttpRequest.get_full_path() [source] Returns the path, plus an appended query string, if applicable. Example: "/music/bands/the_beatles/?print=true"

http.HttpRequest.get_host()

HttpRequest.get_host() [source] Returns the originating host of the request using information from the HTTP_X_FORWARDED_HOST (if USE_X_FORWARDED_HOST is enabled) and HTTP_HOST headers, in that order. If they don’t provide a value, the method uses a combination of SERVER_NAME and SERVER_PORT as detailed in PEP 3333. Example: "127.0.0.1:8000" Note The get_host() method fails when the host is behind multiple proxies. One solution is to use middleware to rewrite the proxy headers, as in the fol

http.HttpRequest.get_port()

HttpRequest.get_port() [source] New in Django 1.9. Returns the originating port of the request using information from the HTTP_X_FORWARDED_PORT (if USE_X_FORWARDED_PORT is enabled) and SERVER_PORT META variables, in that order.

http.HttpRequest.get_signed_cookie()

HttpRequest.get_signed_cookie(key, default=RAISE_ERROR, salt='', max_age=None) [source] Returns a cookie value for a signed cookie, or raises a django.core.signing.BadSignature exception if the signature is no longer valid. If you provide the default argument the exception will be suppressed and that default value will be returned instead. The optional salt argument can be used to provide extra protection against brute force attacks on your secret key. If supplied, the max_age argument will

http.HttpRequest.is_ajax()

HttpRequest.is_ajax() [source] Returns True if the request was made via an XMLHttpRequest, by checking the HTTP_X_REQUESTED_WITH header for the string 'XMLHttpRequest'. Most modern JavaScript libraries send this header. If you write your own XMLHttpRequest call (on the browser side), you’ll have to set this header manually if you want is_ajax() to work. If a response varies on whether or not it’s requested via AJAX and you are using some form of caching like Django’s cache middleware, you sh

http.HttpRequest.is_secure()

HttpRequest.is_secure() [source] Returns True if the request is secure; that is, if it was made with HTTPS.

http.HttpRequest.META

HttpRequest.META A standard Python dictionary containing all available HTTP headers. Available headers depend on the client and server, but here are some examples: CONTENT_LENGTH – The length of the request body (as a string). CONTENT_TYPE – The MIME type of the request body. HTTP_ACCEPT – Acceptable content types for the response. HTTP_ACCEPT_ENCODING – Acceptable encodings for the response. HTTP_ACCEPT_LANGUAGE – Acceptable languages for the response. HTTP_HOST – The HTTP Host header

http.HttpRequest.method

HttpRequest.method A string representing the HTTP method used in the request. This is guaranteed to be uppercase. Example: if request.method == 'GET': do_something() elif request.method == 'POST': do_something_else()

http.HttpRequest.path

HttpRequest.path A string representing the full path to the requested page, not including the scheme or domain. Example: "/music/bands/the_beatles/"

http.HttpRequest.path_info

HttpRequest.path_info Under some Web server configurations, the portion of the URL after the host name is split up into a script prefix portion and a path info portion. The path_info attribute always contains the path info portion of the path, no matter what Web server is being used. Using this instead of path can make your code easier to move between test and deployment servers. For example, if the WSGIScriptAlias for your application is set to "/minfo", then path might be "/minfo/music/ban