# 🔌 Priceloop Python API

Connect to your [Priceloop](https://alpha.priceloop.ai/) Data through our API.

## Installation
There are two ways to install our package:

- Install via pip:
```sh
pip install priceloop-api
```

- Install from Github source:
```sh
git clone git@github.com:priceloop/priceloop-api-python.git
cd priceloop-api-python
python setup.py install
```

## Getting Started

- Export Pandas DataFrame to nocode:
```python
import pandas as pd
from priceloop_api.utils import DefaultConfiguration, to_nocode

configuration = DefaultConfiguration.with_user_credentials('username', 'password')

d = {'col1': [1, 2], 'col2': [3, 4]}
df = pd.DataFrame(data=d)
to_nocode(df, 'table_name', configuration, mode='replace_data')
```
In terms of mode, we currently support four options: `new`, `delete_and_recreate` (default), `replace_data` and `append_data`

- Read from nocode to a Pandas DataFrame:
```python
from priceloop_api.utils import DefaultConfiguration, read_nocode

configuration = DefaultConfiguration.with_user_credentials('username', 'password')
data = read_nocode('table_name', configuration, limit=2, offset=0)
print(data)
```

- Getting the raw data:
```python
from priceloop_api import ApiClient
from priceloop_api.api.default_api import DefaultApi
from priceloop_api.utils import DefaultConfiguration

configuration = DefaultConfiguration.with_user_credentials('username', 'password')

with ApiClient(configuration) as api_client:
    api_instance = DefaultApi(api_client)
    workspaces = api_instance.list_workspaces()
    workspace = api_instance.get_workspace(workspaces[0])
    table = api_instance.get_table(workspace.name, workspace.tables[0].name)
    table_data = api_instance.get_table_data(workspace.name, 'table_name', limit=2, offset=0)
    print(table_data)
```

## API Documentation

API Endpoint and Online-Docs: https://api.alpha.priceloop.ai

[API Docs](docs/DefaultApi.md)

## OpenAPI

This Python package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:

- API version: 1.0
- Package version: 1.0.0
- Build package: org.openapitools.codegen.languages.PythonClientCodegen

## Requirements
- Python >=3.6

## Copyright
See [LICENSE](LICENSE) for details.