netjson-rest
A simple flask rest API's to convert from json config to openwrt and vice versa
The code is Python 2, but Python 3 compatible.
Installation
pip install netjson-rest
For a manual installation
mkdir netjson-rest
wget git@github.com:umeshahp/netjson-rest.git
cd netjson-rest
python setup.py install
cd netjsonFlaskRest
python flaskRestAPI.py
##Usage:
Invoke this API to convert from json to openwrt by http://IP:6000/api/v1/netjson-config/jsontoopenwrt/
data = {
"hostname" : "spanidea",
"timezone" : "IST",
"radios" : [{
"name" : "Spanidea",
"protocol" : "802.11ac" ,
"channel" : 36,
"channel_width" : 20,
"tx_power " : 10,
"country" : "IN"
}
]
,
"wireless": [
{
"name": "lo",
"type": "wireless",
"addresses": [
{
"address": "127.0.0.1",
"mask": 8,
"proto": "static",
"family": "ipv4"
}
]
}
]
}
request above endpoint from python
x = request.post(data =data, url = 'http://<IP>:6000/api/v1/netjson-config/jsontoopenwrt/')
##Call this to convert from openwrt to json : http://:6000/api/v1/netjson-config/openwrttojson/
Example to request from python
multipart_form_data = {
'file2': ('custom_file_name.zip', open('myfile.zip', 'rb')),
'action': (None, 'store'),
'path': (None, '/path1')
}
x = request.post(data = multipart_form_data , url = 'http://<IP>:6000/api/v1/netjson-config/openwrttojson/', files=multipart_form_data )
Metadata
Release files for netjson-rest 1.0.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| netjson-rest-1.0.5.tar.gz | 3.8 kB | Without provenance | Details for netjson-rest-1.0.5.tar.gz |
Release files / netjson-rest-1.0.5.tar.gz
| Download URL | netjson-rest-1.0.5.tar.gz |
|---|---|
| Size | 3.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c922d28ad836422779cf31943251154066d6cd4d81ea79b65e3112f46344a135
|
|
BLAKE2b-256 checksum How to use checksums |
af92dfc6bd7e2906393cd3e2e3bd06a2f9f327cc96cade42cb898cc5003a9ade
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.41.0 CPython/3.7.4
|
Security for netjson-rest 1.0.5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.