raspiblitz/home.admin/BlitzPy
2020-07-19 10:38:41 +01:00
..
blitzpy BlityPy: bump to 0.3.0 2020-07-19 10:38:04 +01:00
dist BlityPy: bump to 0.3.0 2020-07-19 10:38:41 +01:00
CHANGELOG.md BlityPy: bump to 0.3.0 2020-07-19 10:38:04 +01:00
LICENSE BlitzPy initial add 2020-05-22 22:45:37 +01:00
Makefile BlitzPy initial add 2020-05-22 22:45:37 +01:00
MANIFEST.in BlitzPy initial add 2020-05-22 22:45:37 +01:00
README.md Update README.md 2020-05-30 17:58:05 +02:00
setup.cfg BlitzPy initial add 2020-05-22 22:45:37 +01:00
setup.py BlitzPy initial add 2020-05-22 22:45:37 +01:00

BlitzPy

BlitzPy is a part of the RaspiBlitz project and implements a few common use cases.

Installation

Prerequisite

None

Dependencies

None

Install BlitzPy

cd ~/raspiblitz/home.admin/BlitzPy
pip install dist/BlitzPy-0.2.0-py2.py3-none-any.whl
OR
sudo -H python -m pip install dist/BlitzPy-0.2.0-py2.py3-none-any.whl

or consider using a virtual environment

python3 -m venv --system-site-packages venv
source venv/bin/activate
pip install BlitzPy

Usage

Import and use..

from blitzpy import RaspiBlitzConfig
cfg = RaspiBlitzConfig()
cfg.reload()
print(cfg.hostname.value)
if cfg.run_behind_tor.value:
    print("using TOR!")

Changing values

In order to change the content of a setting the value attribute needs to be updated!

from blitzpy import RaspiBlitzConfig
cfg = RaspiBlitzConfig()
cfg.reload()
print(cfg.hostname.value)
cfg.hostname.value = "New-Hostname!"
print(cfg.hostname.value)

Exporting

Use cfg.write() to export file (will use default path - override with cfg.write(path="/tmp/foobar.conf").

from blitzpy import RaspiBlitzConfig
cfg = RaspiBlitzConfig()
cfg.reload()
cfg.rtl_web_interface.value = True
cfg.write()

License

MIT License