Last active
May 30, 2019 14:39
-
-
Save zhreshold/f4defab409cc0e6f6a0e75237f73ca99 to your computer and use it in GitHub Desktop.
Check OS/Python/Cpu Info and Network connections
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import platform, subprocess, sys | |
| print('----------Python Info----------') | |
| print('Version :', platform.python_version()) | |
| print('Compiler :', platform.python_compiler()) | |
| print('Build :', platform.python_build()) | |
| print('Arch :', platform.architecture()) | |
| print('----------System Info----------') | |
| print('Platform :', platform.platform()) | |
| print('system :', platform.system()) | |
| print('node :', platform.node()) | |
| print('release :', platform.release()) | |
| print('version :', platform.version()) | |
| print('machine :', platform.machine()) | |
| print('processor :', platform.processor()) | |
| print('----------Hardware Info----------') | |
| if sys.platform.startswith('darwin'): | |
| pipe = subprocess.Popen(('sysctl', '-a'), stdout=subprocess.PIPE) | |
| output = pipe.communicate()[0] | |
| for line in output.split('\n'): | |
| if 'brand_string' in line or 'features' in line: | |
| print(line.strip()) | |
| elif sys.platform.startswith('linux'): | |
| subprocess.call(['lscpu']) | |
| elif sys.platform.startswith('win32'): | |
| subprocess.call(['wmic', 'cpu', 'get', 'name']) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hey,
What's the license of this gist?