-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
58 additions
and
2 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 |
---|---|---|
@@ -1,6 +1,62 @@ | ||
# Vulcan API | ||
|
||
## Description | ||
Python API for Vulcan E-journal system. It's based on the mobile app, so you can register it as a mobile device on the [site](https://uonetplus.vulcan.net.pl/). | ||
Python API for Vulcan e-journal system. It's based on the mobile app, so you need to register it as a mobile device on the site. | ||
|
||
![alt](https://i.imgur.com/AKBkOJq.png) | ||
![image](https://i.imgur.com/AKBkOJq.png) | ||
|
||
## Installation | ||
You can install `vulcan-api` by `pip` | ||
``` | ||
pip install vulcan-api | ||
``` | ||
|
||
Or manually | ||
``` | ||
pip install flit | ||
git clone https://bitbucket.org/kapi2289/vulcan-api.git | ||
cd vulcan-api | ||
flit install | ||
``` | ||
|
||
## Usage | ||
First, you need to register API as a mobile device on https://uonetplus.vulcan.net.pl/(symbol) | ||
|
||
![image](https://i.imgur.com/x03Aykd.png) | ||
|
||
![image](https://i.imgur.com/OVr5Px4.png) | ||
|
||
```python | ||
from vulcan import Vulcan | ||
import json | ||
|
||
# Vulcan.create(token, symbol, pin) | ||
cert = Vulcan.create('3S1GFG0P', 'gminaglogow', '059671') | ||
|
||
# Save certificate to a file | ||
with open('cert.json') as f: | ||
f.write(json.dumps(cert)) | ||
``` | ||
|
||
When you have API already registered, you can now use it | ||
|
||
```python | ||
from vulcan import Vulcan | ||
import json | ||
|
||
# Load certificate from a file | ||
with open('cert.json') as f: | ||
cert = json.loads(f.read()) | ||
|
||
# Create a client | ||
client = Vulcan(cert) | ||
``` | ||
|
||
API automatically selects first pupil, if you have more than one pupil you can get all of them, and set the default | ||
|
||
```python | ||
users = client.users() | ||
user = users[0] | ||
|
||
client.change_user(user) | ||
``` |