Skip to content
Snippets Groups Projects
Commit 4ea97ad4 authored by DHOMBRES Stephanie's avatar DHOMBRES Stephanie
Browse files

Merge branch 'doc-update' into 'master'

Update file README.md

See merge request !2
parents 76ddcd44 4eb3c948
Branches master
No related tags found
1 merge request!2Update file README.md
......@@ -2,25 +2,31 @@
The following scripts demonstrate how to connect to the [Nanospace Back-end](https://gitlab.isae-supaero.fr/nanostar/nanospace/nanospace-back-end/) and how to interact with it to create, read, update or delete components and values, in the Neo4J database.
> Note: Nanospace Back-end can be installed from Docker images from [demo repository](https://gitlab.isae-supaero.fr/nanostar/nanospace/nanospace-demo).
## 1. Requirements
A [Nanospace Back-end](https://gitlab.isae-supaero.fr/nanostar/nanospace/nanospace-back-end/) is required,
and the following packages :
```bash
sudo apt install python3 python3-pip python-is-python3
sudo apt install python3 python3-pip python-is-python3 git
pip install requests
git clone https://gitlab.isae-supaero.fr/nanostar/nanospace/nanospace-clients/nanospace-python-client.git
```
> Note: You can also use a virtual environment.
## 2. Scripts
This repository has 3 Python scripts:
1. auth_test.py : To test Authentication to [Nanospace Back-end](https://gitlab.isae-supaero.fr/nanostar/nanospace/nanospace-back-end/)
1. nanospace.py : Nanospace API
2. auth_test.py : To test Authentication to [Nanospace Back-end](https://gitlab.isae-supaero.fr/nanostar/nanospace/nanospace-back-end/)
3. simple_example.py : To read/write/delete values in the database from a Python script
### 2.1. Authentication Test to Nanospace-Backend (auth_test.py)
To test the connection to the [Nanospace Back-end](https://gitlab.isae-supaero.fr/nanostar/nanospace/nanospace-back-end/):
> You need to update the script according to your url, username, password:
> You need to update the script according to your url, username, password. An example is given below:
>```
>login_to_api('http://localhost:8888/login', 'test', 'test')
>```
......@@ -87,15 +93,12 @@ Then each one of the _create_ function are returning a Python dictionary where y
#### 2.2.2 Read a value
Read a string using Python:
Read a string and a formula using Python:
```python
# from nanospace import Nanospace
# nanospace = Nanospace('http://server_address/','username', 'password')
print(nanospace.get_string_value(<id>))
```
Read a string using Python:
```python
print(nanospace.get_formula_value(<id>))
```
......@@ -126,6 +129,8 @@ Expected response (if the `<id>` exists and the token is valid):
Update a string :
```python
# from nanospace import Nanospace
# nanospace = Nanospace('http://server_address/','username', 'password')
print(nanospace.get_string_value(66))
nanospace.update_value(66, 'string_example', '9000000')
print(nanospace.get_string_value(66)) # Should print 9000000
......@@ -134,6 +139,8 @@ print(nanospace.get_string_value(66)) # Should print 9000000
Update a formula :
```python
# from nanospace import Nanospace
# nanospace = Nanospace('http://server_address/','username', 'password')
print(nanospace.get_formula_value(77))
nanospace.update_value(77, 'formula_-_example', '9000000')
print(nanospace.get_formula_value(77)) # Should print 9000000
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment