import os
domain = os.environ['userdomain']
print(domain)
import getpass
import os
print(os.getlogin())
print(getpass.getuser())
import json, requests, socket, uuid
from datetime import datetime
now_time = datetime.now()
now_time = now_time.strftime("%Y%m%d%H%M%S")
address = hex(uuid.getnode())[2:]
print('-'.join(address[i:i+2] for i in range(0, len(address), 2)))
print(now_time)
print(socket.gethostname())
>>> import socket
>>> hostname = socket.gethostname()
>>> hostname
'DESKTOP-I734J3O'
>>> socket.gethostbyname(hostname)
'192.168.0.103'
参考
http://cn.voidcc.com/question/p-dpdhfyha-np.html
https://www.jianshu.com/p/d7b51e897d56