Metadata-Version: 2.1
Name: pytoque
Version: 0.1.1
Summary: A package that facilitates requests and has some tools for the El-Toque API
Home-page: https://github.com/LeivSuaxy/pytoque
Author: jleivsuaxy
Author-email: jleivsuaxy@gmail.com
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: certifi==2024.8.30
Requires-Dist: charset-normalizer==3.4.0
Requires-Dist: idna==3.10
Requires-Dist: requests==2.32.3
Requires-Dist: urllib3==2.2.3

# PyToque Class

Class with methods to make requests to the ElToque API (Cuba).
## Installation
```python
pip install pytoque
```

## How to use
First you will need to request a personal token from the ElToque site. 

### Explanation
https://eltoque.com/eltoque-abre-acceso-a-su-api-de-las-tasas-de-cambio

### Form to obtain token
https://tasas-token.eltoque.com/

Open your virtual environment and install dependencies

_Create Virtual Environment_
```python
python -m venv .venv   
```
If you use Linux remember to use python3

<br/>

_Activate Virtual Environment_
### Linux
```bash
source .venv/bin/activate
```

### Windows
```bash
.venv\Scripts\activate
```

_Install Dependencies_
```python
pip install -r requirements.txt
```

_Import the PyToque class and initialize it by sending the api_key obtained on the official ElToque site as a parameter._

**Warning** Remember to be careful with the privacy of your personal token.

```python
from pytoque.pytoque.core import PyToque

toque = PyToque(api_key=API_KEY)
```

## Docs

### get_today() -> dict
Returns the exchange rates for the current date.

#### Additional Params

- filters: List of strings with exchange rate abbreviations

Available filters: ['ECU', 'TRX', 'USDT_TRC20', 'BTC', 'BNB', 'USD', 'MLC']

#### Exceptions
- Exception('Incorrect Filters') If filters are not available
- Exception(f'The response was not satisfactory, HTTP STATUS: {response.status_code}') In case the API returns another
status code, check the eltoque api documentation to see more.
- RequestException() In case a failure occurs in the request


### get_date(date: str) -> dict
Date parameter in format (YYYY-MM-DD)

Returns the exchange rates of the given date.

#### Additional Params

- filters: List of strings with exchange rate abbreviations

Available filters: ['ECU', 'TRX', 'USDT_TRC20', 'BTC', 'BNB', 'USD', 'MLC']

#### Exceptions
- Exception('Incorrect Filters') If filters are not available
- Exception(f'The response was not satisfactory, HTTP STATUS: {response.status_code}') In case the API returns another
status code, check the eltoque api documentation to see more.
- RequestException() In case a failure occurs in the request
- Exception('Please provide a date in format "YYYY-MM-DD"') In case a bad date format is sent


