I'm trying to find something I can use as a unique string/number for my script that is fixed in a machine and easily obtainable(cross-platform). I presume a machine would have a network card. I don't need it to be really unique, but the necessary is it should be fixed in a long run and as rare as possible.
I know MAC can be changed and I'd probably make a warning about it in my script, however I don't expect anyone to change MAC each morning.
What I came up with is uuid.getnode()
, but in the docs there is:
If all attempts to obtain the hardware address fail, we choose a random 48-bit number
Does it mean that for each function call I get another random number, therefore it's not possible to use it if MAC is unobtainable?
...on a machine with multiple network interfaces the MAC address of any one of them may be returned.
Does this sentence mean getnode()
gets a random(or first) MAC from all available? What if it'd get MAC A in first run and MAC B next time? There'd be no problem if I'd get a fixed list(sort, concatenate, tadaaa!)
I'm asking because I have no way how to test it myself.