/dolar-hoy-api

๐Ÿ’ฐ Dolar hoy APIRest made with fastapi

Primary LanguagePythonGNU General Public License v3.0GPL-3.0

๐Ÿ’ฐ Dolar-hoy API

IMG

Codacy Badge

DigitalOcean Referral Badge

๐Ÿ“ Description

Project to learn how to deploy and mantain a REST API using FastAPI and Docker. The API is a simple GET endpoint that returns the current value of the dolar in Argentina. Values are being scrapped from DolarHoy and saved in PlanetScale.

๐Ÿƒ Run

To run the project you need to have Docker installed in your machine. Then, you can run the following command:

docker compose up

๐Ÿงช Endpoints

GET /dolar/:currency
POST /manual

Where :currency can be

  • blue
  • oficial
  • crypto
  • mep

๐Ÿ–ฅ Examples

curl -X GET "http://localhost:4500/dolar/blue" -H  "accept: application/json"

Response

{
  "label": "Dolar Blue",
  "prices": {
    "buy_price": 488,
    "sell_price": 493
  },
  "last_update": "2023-05-25 20:35:58" // UTC -3
}

๐ŸŒป Workflow

image

๐Ÿงฐ Stack

  • Python
  • FastAPI
  • Docker
  • PlanetScale
  • GitHub Actions
  • DigitalOcean
  • Nginx

๐Ÿ”’ Environment Variables

Name Description Default
HOST Host to run the API xxx
USERNAME Username to connect to PlanetScale xxx
PASSWORD Password to connect to PlanetScale xxx
DATABASE Database to connect to PlanetScale xxx
MANUAL_USERNAME Username to use the scrapper xxx
MANUAL_PASSWORD Password to use the scrapper xxx