Skip to main content

A package that facilitates requests and has some tools for the El-Toque API

Project description

PyToque Class

Class with methods to make requests to the ElToque API (Cuba).

Installation

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 -m venv .venv   

If you use Linux remember to use python3


Activate Virtual Environment

Linux

source .venv/bin/activate

Windows

.venv\Scripts\activate

Install Dependencies

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.

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pytoque-0.2.0.tar.gz (7.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pytoque-0.2.0-py3-none-any.whl (7.6 kB view details)

Uploaded Python 3

File details

Details for the file pytoque-0.2.0.tar.gz.

File metadata

  • Download URL: pytoque-0.2.0.tar.gz
  • Upload date:
  • Size: 7.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.3

File hashes

Hashes for pytoque-0.2.0.tar.gz
Algorithm Hash digest
SHA256 a4df7936d16a399a7fbad706f9a7bb0f8711c6cbdf8eea581c133909f7bfca27
MD5 18135ccc119057b22f9d9143e9cb1ee0
BLAKE2b-256 2b4baf95f5e11852b4b46eaafc51aeb91a7d5ff3cca753da26d64122b2300e96

See more details on using hashes here.

File details

Details for the file pytoque-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: pytoque-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 7.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.3

File hashes

Hashes for pytoque-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c060cfd35c7dd97a7648ae9ed8aac1408929b90e2dee500bdfa8d924ba280a91
MD5 39d9cad6dd20ae495e335ebe02aac9a3
BLAKE2b-256 e5b8a6548522eabc028f40bed41783f012d76849c26e7c21c5577705bf72617a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page