Python api-client for Kurtuba
Api клиент для облачного хранилища Kurtuba
- Create token
- Refresh token
- Get value of a property from the storage
- Get all storage data
- Set key/value
- Remove element it storage
- Delete storage
- Get backup list
- Restoring the vault from a backup
pip install pyKurtuba
Example:
from pyKurtuba import Kurtuba
test = Kurtuba('http://localhost:3199')
test.new_token()
All parameters (domains, backup, password) are optional:
from pyKurtuba import Kurtuba
test = Kurtuba('http://localhost:3099',domains=['google', 'yandex'], backup=True, password='12345')
test.new_token()
View Response
{
"status": true,
"data":{
"token": "002cac23-aa8b-4803-a94f-3888020fa0df",
"refreshToken": "5bf365e0-1fc0-11e8-85d2-3f7a9c4f742e"
}
}
To write data to the storage, you need to transfer the data object:
test.set_data(token, {test:2})
View Response
{
"status": true,
"message": "Successfully added"
}
test.remove(token, key)
token - токен
key - имя элемента
test.delete(token)
token - токен
Если вам нужно получить все данные, которые есть в хранилище:
test.get_all(token, name)
View Response
{
"status": true,
"data": {
name: 'hazratgs',
age: 25,
city: 'Derbent'
skills: ['javascript', 'react+redux', 'nodejs', 'mongodb']
}
}
test.get(token, key)
View Response
{
"status": true,
"data": "hazratgs"
}
test.get(token, key)
View Response
{
"status": true,
"message": "Successfully deleted"
}
If you passed a parameter backup
when creating a token, then your repository will have backup copies, which are created every 2 hours and stored during the day.
In order to get a list of active copies of the repository, send the request:
test.backup(token)
View Response
{
"status": true,
"data": [
'Sun Mar 04 2018 19:39:42 GMT+0300 (MSK)',
'Sun Mar 04 2018 20:39:42 GMT+0300 (MSK)'
]
}
To return the store to a specific checkpoint, pass the date of the checkpoint:
test.restore(token, name_backup)
View Response
{
"status": true,
"message": "Successfully restored"
}