In this article you will learn how to get web httprequest in Odoo and fetch useful information from
HTTP Request in Odoo.
HTTPRequest | Odoo
By using odoo httprequest we can get following informations.
- Getting and setting cookie information (HTTP_COOKIE)
- Getting if a request method is GET or POST (REQUEST_METHOD)
- Identify machine on which odoo/openerp is opened (HTTP_USER_AGENT)
- Identify address of web page or URL (HTTP_REFERER)
- Identify server name in odoo (SERVER_NAME)
- Getting remote port in odoo (REMOTE_PORT)
- Getting server port in odoo (SERVER_PORT)
- Getting user IP Address / Non-virtualhost in odoo (REMOTE_ADDR)
- 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
2 Comments
Hello,
ReplyDeleteThank you for posting such a nice info. Is there a method to get cookie expiry date?
I will soon upload your problem solution, thanks for your comment
Delete