34 lines
564 B
Python
34 lines
564 B
Python
# _*_ coding: utf-8 _*_
|
|
# @Time :2022/5/26 09:33
|
|
# @Email :508737091@qq.com
|
|
# @Author :qiangyanwen
|
|
# @File :system.py
|
|
import socket
|
|
import sys
|
|
from _yaml import yaml
|
|
|
|
|
|
def get_host_ip():
|
|
"""
|
|
查询本机ip地址
|
|
:return:
|
|
"""
|
|
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
|
|
try:
|
|
s.connect(('8.8.8.8', 80))
|
|
ip = s.getsockname()[0]
|
|
finally:
|
|
s.close()
|
|
|
|
return ip
|
|
|
|
|
|
def current_platform():
|
|
return sys.platform
|
|
|
|
|
|
system = current_platform()
|
|
host = get_host_ip()
|
|
|
|
|
|
__all__ = ["system", "host"] |