Client to NIS backend
Project description
Python client for NIS Backend
A Python client package to operate with NIS-Backend
NIS stands for "Nexus Information System". It is a software system (a set of software components) developed as part of project "MAGIC" activities (H2020 grant #689669). NIS-Backend is the main component, an engine capable of interpreting and resolving MuSIASEM (sustainability, water-energy-food nexus, bioeconomic) models expressed using a DSL in spreadsheet form. For more information go to nis-backend repository at Github.
Getting started
Prerequisites
- Python 3.x
- A NIS backend instance has to be running and accessible. The URL of the API endpoint is the required parameter for the construction of the client. See the example in "Basic Usage" section below. For instructions on executing nis-backend please check README.md at Github.
Installing
pip install nexinfosys-client
Basic Usage
from nexinfosys import NISClient
c = NISClient("http://localhost:5000/nis_api") # Construct client
c.login("test_user") # Login, using test user
c.open_session() # Open a session (needed before submission)
fname = "<path to XLSX specifying a case study (accessible to the Python interpreter executing this script)>"
c.load_workbook(fname) # Load a workbook (see DMP's annex "Case study formatting reference")
# Submit the workbook (execute, return a list of issues, if empty or no issues with type==3, successful execution)
r = c.submit()
success = sum([i.type==3 for i in r]) == 0
for i in r: # Print issues
print(str(i))
if success:
r = c.query_available_datasets() # Obtain available datasets
if len(r) > 0:
for ds in r: # List available datasets
print(str(ds))
# Query for one of the datasets ("ds1" must exist)
r = c.query_datasets([("ds1", "csv")])
# Write datasets
for cnt, f in enumerate(r):
fd = open(f[0]+"."+f[1], "wb")
fd.write(f[2])
fd.close()
# Close session
c.close_session()
# Logout
c.logout()
Authors
- Rafael Nebot. Instituto Tecnológico de Canarias, SA. Departamento de Computación
License
This project is licensed under the BSD-3 License - see the LICENSE file for details
Acknowledgements
The development of this software was supported by the European Union’s Horizon 2020 research and innovation programme under Grant Agreement No. 689669 (MAGIC). This work reflects the authors' view only; the funding agencies are not responsible for any use that may be made of the information it contains.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file nexinfosys-client-0.22.tar.gz
.
File metadata
- Download URL: nexinfosys-client-0.22.tar.gz
- Upload date:
- Size: 33.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/45.2.0.post20200209 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ecb85b2fff3ba6120936815704d2eba752a427a0378920a44e6bfc343e407e6f |
|
MD5 | f6cf492ac5e1a486b693dfcfa32be79e |
|
BLAKE2b-256 | 3b7e3c4a2b093671d0a07a425033b7faac77030a4543e69b4539af44be06d90a |
File details
Details for the file nexinfosys_client-0.22-py3-none-any.whl
.
File metadata
- Download URL: nexinfosys_client-0.22-py3-none-any.whl
- Upload date:
- Size: 12.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/45.2.0.post20200209 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5b2538e39fdb96a407a566f04fafa6a884aab78cffe18763fbb5188f3a939f1a |
|
MD5 | 163c58b5ac7e3a2a28a3daa966936893 |
|
BLAKE2b-256 | 6e2b0b0c2ea9be2791bf6fcebbbd6d10b6a0ee746f839120a38cce39e451cca9 |