Ajout script de récupération de token
This commit is contained in:
commit
1f3a52fd04
29
README.md
Normal file
29
README.md
Normal file
@ -0,0 +1,29 @@
|
||||
# Notes sur pycloud
|
||||
|
||||
## Faire tourner le serveur
|
||||
|
||||
Depuis le dépot git pycloud2/pycloud-api.
|
||||
|
||||
1. Build l'image docker
|
||||
|
||||
```
|
||||
docker build -t pycloud:latest .
|
||||
```
|
||||
|
||||
2. Run l'image
|
||||
|
||||
```
|
||||
docker run -p 8080:8080 --rm --name pycloud pycloud:latest
|
||||
```
|
||||
|
||||
## Utiliser le serveur pycloud
|
||||
|
||||
Depuis le présent dépot git
|
||||
|
||||
3. Get token
|
||||
|
||||
```
|
||||
./get_token.sh
|
||||
```
|
||||
|
||||
Ne pas oublier d'utiliser ce token (de type Bearer) à chaque fois qu'on veut utiliser l'API de VRA8
|
12
test.py
Normal file
12
test.py
Normal file
@ -0,0 +1,12 @@
|
||||
#!/bin/bash
|
||||
|
||||
username=XXX@cloe # login_ac_dijon@cloe
|
||||
password= # mot de passe défini via l'iface web de CLOE VRA8
|
||||
|
||||
refresh_token=$(curl -X POST -H "Content-Type: application/json" -d "{\"username\":\"${username}\", \"password\":\"${password}\"}" 127.0.0.1:8080/login | jq -r .refresh_token)
|
||||
echo refresh_token: $refresh_token
|
||||
|
||||
token=$(curl -X POST -H "Content-Type: application/json" -d "{\"refresh_token\":\"${refresh_token}\"}" 127.0.0.1:8080/perform-login | jq -r .token)
|
||||
echo token: $token
|
||||
|
||||
curl -H "Authorization: Bearer ${token}" 127.0.0.1:8080/catalog-types | jq
|
Loading…
Reference in New Issue
Block a user