Giter VIP home page Giter VIP logo

dmiparse's Introduction

dmiparse

parse dmidecode with python

Build Status codecov

dmiparse

Convert dmidecode output into clean queryable structure

Installation

pip3 install dmiparse

Example

In [7]: print(sample1)

# dmidecode 3.1
Getting SMBIOS data from sysfs.
SMBIOS 2.6 present.

Handle 0x0001, DMI type 1, 27 bytes
System Information
		Manufacturer: LENOVO
		Product Name: 20042
		Version: Lenovo G560
		Serial Number: 2677240001087
		UUID: CB3E6A50-A77B-E011-88E9-B870F4165734
		Wake-up Type: Power Switch
		SKU Number: Calpella_CRB
		Family: Intel_Mobile



In [8]: from dmiparse import parse_dmi

In [9]: parse_dmi(sample1)
Out[9]: {'System Information': <dmiparse.Section at 0x7f88b0a5add8>}

In [10]: from json import dumps

In [11]: print(dumps(parse_dmi(sample1), default=lambda o: o.__dict__, indent=4))
{
    "System Information": {
        "props": {
            "Manufacturer": {
                "val": "LENOVO",
                "items": []
            },
            "Product Name": {
                "val": "20042",
                "items": []
            },
            "Version": {
                "val": "Lenovo G560",
                "items": []
            },
            "Serial Number": {
                "val": "2677240001087",
                "items": []
            },
            "UUID": {
                "val": "CB3E6A50-A77B-E011-88E9-B870F4165734",
                "items": []
            },
            "Wake-up Type": {
                "val": "Power Switch",
                "items": []
            },
            "SKU Number": {
                "val": "Calpella_CRB",
                "items": []
            },
            "Family": {
                "val": "Intel_Mobile",
                "items": []
            }
        },
        "title": "System Information",
        "handleline": "Handle 0x0001, DMI type 1, 27 bytes"
    }
}

running tests

tox or pytest

dmiparse's People

Contributors

xmonader avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

abom marcbln xqzts

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.