Skip to content

Readme suggestion - pretty print all getInfo keys #3

@surfaceowl

Description

@surfaceowl

The getInfo method returns a nice dict with all the device info of a raspberry pi. The current example in the Readme shows the user how to retrieve a single key/value pair - but the user may not know all values available from pirev.

It may be helpful to add an example in the Readme, which pretty prints all results returned by getInfo. The example below uses the json library to do this (already part of the standard Python library), and keeps with the zero-dependency goal of this project:

In [2]: from pirev.pirev import getInfo

In [3]: info = getInfo()

In [4]: import json

In [5]: print(json.dumps(info, indent=2))
{
  "cpus": [
    {
      "processor": 0,
      "model_name": "ARMv6-compatible processor rev 7 (v6l)",
      "bogomips": 797.66,
      "features": "half thumb fastmult vfp edsp java tls",
      "cpu_implementer": 65,
      "cpu_architecture": 7,
      "cpu_variant": 0,
      "cpu_part": 2934,
      "cpu_revision": 7
    }
  ],
  "hardware": "BCM2835",
  "revision": {
    "type": "B",
    "memory": "256 MB",
    "processor": "BCM2835",
    "revision": 1.0,
    "manufacturer": "Egoman",
    "code": 3
  },
  "serial": "00000000e96a5c9e",
  "model": "Raspberry Pi Model B Rev 1"
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions