Skip to content

A Python project with web scraping to get dollar current value in real or swap them and vice versa.

Notifications You must be signed in to change notification settings

abelbarreto-dev/brl-usd-api

Repository files navigation

BRL USD API

A Python project with web scraping to get dollar current value in real or swap them and vice versa. This software only works with US Dollar <> Brazilian Real swap operations.

This project do a web scraping from the website Investing.

That's a Rest API.

Summary

Dependencies

It is a list of known project dependencies, you can find all of them at requirements.txt file.

{
  "Python3.x",
  "Pip",
  "Python Dotenv",
  "Pydantic",
  "Requests",
  "Flask",
  "Flask Assync",
  "BeautifulSoap4",
  "Pytest",
}

To install these dependencies, see:

The 2nd point teach how to install it fast. You can make a choice, but you must to know, it's required!

API Routes

See each route and each HTTP method.

  • GET /usd-price-brl
    • How much is US Dollar in Brazilian Real
  • GET /brl-price-usd
    • How much is Brazilian Real in US Dollar
  • POST /usd-to-brl
    • Swap from US Dollar to Brazilian Real
  • POST /brl-to-usd
    • Swap from Brazilian Real to US Dollar

Models

See the models used at this project to make a request, you need:

Real to Dollar, you send Brazilian Reals then receive US Dollars;
{
  "value_brl": "0.00"
}
Dollar to Real, you send US Dollars then receive Brazilian Reals;
{
  "value_usd": "0.00"
}

How to Run

IMPORTANT: before you run, please see install dependencies or install quickly, after you can: RENAME or DUPLICATE .env.example as .env.

Please Don't edit this file, it has important hyperlinks, if you do it, this application will not work else you change the logic used here.

Just run the file main.py and use a software to make requests for each route. You can find our routes at API Routes.

Some details: I recommend you use a virtual python environment interpreter to test this application. See more in: python venv docs.

Install Dependencies

See these details of how to install dependencies, FIRSTLY step by step, AFTER how to install it quickly.

Python
Windows Python Windows
MacOS Python MacOS
Linux Pre Installed.
Install Pip pip3 install pip --upgrade
Python DotEnv pip install python-dotenv
Flask pip install Flask
BeautifulSoap 4 pip install beautifulsoup4
Pydantic pip install pydantic
Requests pip install requests
PyTest pip install pytest
Flask Assync pip install asgiref

Install Dependencies Quickly

This project has a file named requirements.txt, where you find a list of project dependencies. To install it quickly, you can run the following command:

pip install -r requirements.txt

That's All Folks!

About

A Python project with web scraping to get dollar current value in real or swap them and vice versa.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published