https://github.com/samjrdn/pirev-python
Raspberry Pi hardware revision utility for python
https://github.com/samjrdn/pirev-python
detect pi python raspberry raspberry-pi raspberrypi revision rpi version
Last synced: 2 months ago
JSON representation
Raspberry Pi hardware revision utility for python
- Host: GitHub
- URL: https://github.com/samjrdn/pirev-python
- Owner: samjrdn
- License: mit
- Created: 2018-09-13T04:06:02.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-06-25T01:47:49.000Z (over 6 years ago)
- Last Synced: 2025-09-23T21:25:51.513Z (3 months ago)
- Topics: detect, pi, python, raspberry, raspberry-pi, raspberrypi, revision, rpi, version
- Language: Python
- Size: 14.6 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# pirev
[](https://pypi.org/project/pirev/)
[](https://opensource.org/licenses/MIT)
A tiny, zero-dependency utility providing hardware revision information for Raspberry Pi devices. All information is parsed from the device's [revision code](https://www.raspberrypi.org/documentation/hardware/raspberrypi/revision-codes/README.md) located in `/proc/cpuinfo`.
## Installation
```
pip install pirev
```
## Usage
```
from pirev import getInfo
info = getInfo()
print('Raspberry Pi {type}'.format(type=info['revision']['type']))
```
## Error handling
Running the utility on a device which is **not** a Raspberry Pi will result in an error being raised.
```
try:
info = getInfo()
print('Raspberry Pi {type}'.format(type=info['revision']['type']))
except ReferenceError:
print('Not a Raspberry Pi device!')
```