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.1.1.tar.gz (6.5 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.1.1-py3-none-any.whl (6.7 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for pytoque-0.1.1.tar.gz
Algorithm Hash digest
SHA256 58362940d682757de5074d23f774c7e3772069a74cb89dbd87daa742586411f6
MD5 6aeb39a9ee0883f770126358029613cb
BLAKE2b-256 90b1a739fd083318917730fcb631e0345a4469e8f8691552ed2ffb9cc24bb312

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pytoque-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 6.7 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.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f2dabc4fb1fe8d462d718cf32def4cbaf3cfce96109adb64181d54e37f6366a0
MD5 4e37139c2e92ce976d4f7cb2123d8971
BLAKE2b-256 e2c4ce6e2d37fc9d5119e4f96010d10a7cc899b43d61d5ff03ab3ce1a078e54e

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