Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/gadzhi/pykurtuba

Python client library for Kurtuba
https://github.com/gadzhi/pykurtuba

api-client key-value kurtuba mongo-db python-api-client-for-kurtuba storage-api

Last synced: 10 days ago
JSON representation

Python client library for Kurtuba

Awesome Lists containing this project

README

        

# pyKurtuba
[![PyPI version](https://badge.fury.io/py/pyKurtuba.svg)](https://pypi.python.org/pypi/pyKurtuba)

Python api-client for [**Kurtuba**](https://github.com/hazratgs/kurtuba-storage)

Api клиент для облачного хранилища [**Kurtuba**](https://github.com/hazratgs/kurtuba-storage)

### Features
- 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

## Getting Started

##### Install
```python
pip install pyKurtuba
```

Example:
```python

from pyKurtuba import Kurtuba

test = Kurtuba('http://localhost:3199')

test.new_token()
```

## API

### Create token

All parameters (domains, backup, password) are optional:


```python
from pyKurtuba import Kurtuba

test = Kurtuba('http://localhost:3099',domains=['google', 'yandex'], backup=True, password='12345')

test.new_token()
```


View Response

```js
{
"status": true,
"data":{
"token": "002cac23-aa8b-4803-a94f-3888020fa0df",
"refreshToken": "5bf365e0-1fc0-11e8-85d2-3f7a9c4f742e"
}
}
```

#### Writing data to storage
To write data to the storage, you need to transfer the data object:

```python
test.set_data(token, {test:2})
```

View Response

```js
{
"status": true,
"message": "Successfully added"
}
```

### Удаление элемента

```python
test.remove(token, key)
```

*token* - токен

*key* - имя элемента

### Удаление храналища

```python
test.delete(token)
```

*token* - токен

#### Get all storage

Если вам нужно получить все данные, которые есть в хранилище:

```python
test.get_all(token, name)
```

View Response

```js
{
"status": true,
"data": {
name: 'hazratgs',
age: 25,
city: 'Derbent'
skills: ['javascript', 'react+redux', 'nodejs', 'mongodb']
}
}
```

#### Get property

```python
test.get(token, key)
```

View Response

```js
{
"status": true,
"data": "hazratgs"
}
```

#### Remove property

```python
test.get(token, key)
```


View Response

```js
{
"status": true,
"message": "Successfully deleted"
}
```

#### Get backup list storage
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:

```python
test.backup(token)
```

View Response

```js
{
"status": true,
"data": [
'Sun Mar 04 2018 19:39:42 GMT+0300 (MSK)',
'Sun Mar 04 2018 20:39:42 GMT+0300 (MSK)'
]
}
```

#### Restoring the vault from a backup
To return the store to a specific checkpoint, pass the date of the checkpoint:

```python
test.restore(token, name_backup)
```


View Response

```js
{
"status": true,
"message": "Successfully restored"
}
```