Search Here

Get web httprequest

In this article you will learn how to get web httprequest in Odoo and fetch useful information from HTTP Request in Odoo.
Get web httprequest in odoo - HTTP Request


HTTPRequest | Odoo

By using odoo httprequest we can get following informations.

  1. Getting and setting cookie information (HTTP_COOKIE)
  2. Getting if a request method is GET or POST (REQUEST_METHOD)
  3. Identify machine on which odoo/openerp is opened (HTTP_USER_AGENT)
  4. Identify address of web page or URL (HTTP_REFERER)
  5. Identify server name in odoo (SERVER_NAME)
  6. Getting remote port in odoo (REMOTE_PORT)
  7. Getting server port in odoo (SERVER_PORT)
  8. Getting user IP Address / Non-virtualhost in odoo (REMOTE_ADDR)
  9. Getting user real IP Address in odoo (HTTP_X_REAL_IP)

Getting and setting cookie information (HTTP_COOKIE)

request.httprequest.environ['HTTP_COOKIE']

Getting if a request method is GET or POST (REQUEST_METHOD)

request.httprequest.environ['REQUEST_METHOD']

Identify machine on which odoo/openerp is opened (HTTP_USER_AGENT)

request.httprequest.environ['HTTP_USER_AGENT']

Identify address of web page or URL (HTTP_REFERER)

request.httprequest.environ['HTTP_REFERER']

Identify server name in odoo (SERVER_NAME)

request.httprequest.environ['SERVER_NAME']

Getting remote port in odoo (REMOTE_PORT)

request.httprequest.environ['REMOTE_PORT']

Getting server port in odoo (SERVER_PORT)

request.httprequest.environ['SERVER_PORT']

Getting user IP Address / Non-virtualhost in odoo (REMOTE_ADDR)

request.httprequest.environ['REMOTE_ADDR']

Getting user real IP Address in odoo (HTTP_X_REAL_IP)

request.httprequest.environ.get('HTTP_X_REAL_IP'))

Don,t forgot to share, keep sharing keep learning 

Post a Comment

2 Comments

  1. Hello,

    Thank you for posting such a nice info. Is there a method to get cookie expiry date?

    ReplyDelete
    Replies
    1. I will soon upload your problem solution, thanks for your comment

      Delete