I am looking for an anonymous survey. However, I want users not to vote twice. I was thinking of hashing some request.META values, for example:
from hashlib import md5 request_id_keys = ( 'HTTP_ACCEPT_CHARSET', 'HTTP_ACCEPT', 'HTTP_ACCEPT_ENCODING', 'HTTP_ACCEPT_LANGUAGE', 'HTTP_CONNECTION', 'HTTP_USER_AGENT', 'REMOTE_ADDR', ) request_id = md5('|'.join([request.META.get(k, '') for k in requst_id_keys])).hexdigest()
My questions:
- A good idea? Bad idea? Why?
- Are some of these keys redundant or just redundant? Why?
- Are some of them easy to change? For example, I am considering removing
HTTP_USER_AGENT because I know that it is just a configuration change. - Know the best way to execute this semi-unique identifier, which is flexible enough to handle people using IP (NAT), but that just changing the configuration won't create a new hash?
source share