-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Álvaro Fernández Rojas <[email protected]>
- Loading branch information
0 parents
commit 73d317d
Showing
14 changed files
with
913 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,139 @@ | ||
name: CI | ||
|
||
on: | ||
- push | ||
- pull_request | ||
|
||
env: | ||
DEFAULT_PYTHON: 3.9 | ||
|
||
jobs: | ||
black: | ||
name: Check Black | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- name: Check out code from GitHub | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up Python ${{ env.DEFAULT_PYTHON }} | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: ${{ env.DEFAULT_PYTHON }} | ||
|
||
- name: Upgrade pip | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip --version | ||
- name: Install Black | ||
run: | | ||
pip install black | ||
- name: Run Black | ||
run: | | ||
black --check --diff openwrt/ubus | ||
flake8: | ||
name: Check Flake8 | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- name: Check out code from GitHub | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up Python ${{ env.DEFAULT_PYTHON }} | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: ${{ env.DEFAULT_PYTHON }} | ||
|
||
- name: Upgrade pip | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip --version | ||
- name: Install Flake8 | ||
run: | | ||
pip install flake8 | ||
- name: Run Flake8 | ||
run: | | ||
flake8 openwrt/ubus | ||
isort: | ||
name: Check isort | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- name: Check out code from GitHub | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up Python ${{ env.DEFAULT_PYTHON }} | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: ${{ env.DEFAULT_PYTHON }} | ||
|
||
- name: Upgrade pip | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip --version | ||
- name: Install isort | ||
run: | | ||
pip install isort | ||
- name: Run isort | ||
run: | | ||
isort --check-only openwrt/ubus | ||
mypy: | ||
name: Check Mypy | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- name: Check out code from GitHub | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up Python ${{ env.DEFAULT_PYTHON }} | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: ${{ env.DEFAULT_PYTHON }} | ||
|
||
- name: Upgrade pip | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip --version | ||
- name: Install Mypy | ||
run: | | ||
pip install mypy | ||
- name: Run mypy | ||
run: | | ||
mypy openwrt/ubus | ||
pylint: | ||
name: Check Pylint (Python ${{ matrix.python-version }}) | ||
runs-on: ubuntu-20.04 | ||
strategy: | ||
matrix: | ||
python-version: [3.8, 3.9] | ||
steps: | ||
- name: Check out code from GitHub | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Upgrade pip | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip --version | ||
- name: Install Requirements | ||
run: | | ||
pip install -r requirements.txt | ||
- name: Install Pylint | ||
run: | | ||
pip install pylint | ||
- name: Run Pylint | ||
run: | | ||
pylint openwrt/ubus |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
{ | ||
"problemMatcher": [ | ||
{ | ||
"owner": "pylint-error", | ||
"severity": "error", | ||
"pattern": [ | ||
{ | ||
"regexp": "^(.+):(\\d+):(\\d+):\\s(([EF]\\d{4}):\\s.+)$", | ||
"file": 1, | ||
"line": 2, | ||
"column": 3, | ||
"message": 4, | ||
"code": 5 | ||
} | ||
] | ||
}, | ||
{ | ||
"owner": "pylint-warning", | ||
"severity": "warning", | ||
"pattern": [ | ||
{ | ||
"regexp": "^(.+):(\\d+):(\\d+):\\s(([CRW]\\d{4}):\\s.+)$", | ||
"file": 1, | ||
"line": 2, | ||
"column": 3, | ||
"message": 4, | ||
"code": 5 | ||
} | ||
] | ||
} | ||
] | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
*.egg-info | ||
*.patch | ||
*.pyc | ||
dist |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
[MESSAGES CONTROL] | ||
disable = | ||
too-few-public-methods, | ||
too-many-arguments, | ||
too-many-branches, | ||
too-many-instance-attributes, | ||
too-many-statements |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
openwrt-ubus-rpc is a Python module implementing an interface to the OpenWrt ubus RPC API. | ||
It allows a user to perform Remote Procedure Calls (RPC) to the OpenWrt micro bus architecture (ubus). | ||
|
||
Documentation for the OpenWrt ubus RPC API is available at https://openwrt.org/docs/techref/ubus and https://openwrt.org/docs/guide-developer/ubus. | ||
|
||
This package has been developed to be used with https://home-assistant.io/ but it can be used in other contexts. | ||
|
||
Disclaimer | ||
---------- | ||
|
||
openwrt-ubus-rpc was created for my own use, and for others who may wish to experiment with personal Internet of Things systems. | ||
|
||
This software is provided without warranty, according to the GNU Public Licence version 2, and should therefore not be used where it may endanger life, financial stakes or cause discomfort and inconvenience to others. | ||
|
||
Usage | ||
----- | ||
|
||
``` | ||
from openwrt.ubus import Ubus | ||
_ubus = Ubus(host="http://openwrt_host/ubus", user="openwrt_user", password="openwrt_password") | ||
_ubus.connect() | ||
_ubus.get_hostapd() | ||
_ubus.get_hostapd_clients("hostapd.wlan0") | ||
``` |
Oops, something went wrong.