Skip to content

Latest commit

 

History

History
20 lines (14 loc) · 1.2 KB

README.md

File metadata and controls

20 lines (14 loc) · 1.2 KB

py-crypto-api example workflow

Super simple Python API for fetching cryptocurrency exchange rate via Google Search.
Written with FastAPI and scraping via BeautifulSoup4.

Installation

Firstly you need to install dependencies pip install -r requirements.txt.
To host API you need to run it with uvicorn --reload main:app (the default port is 8000).
(the --reload switch is optional)

Testing and development was taken on Python 3.10.

Usage

URL Description Output
localhost:8000/v1/{query} Replace {query} with search phrase,
for e.g. "1 btc to usd"
Outputs JSON formatted response e.g. {"amount":"9.9"}
where 9.9 is amount of USD for 1 Bitcoin
localhost:8000/v2/?crypto={value}&currency={value} Replace {value} correspondingly to
query params
Outputs JSON formatted response e.g. {"amount":"9.9"}
where 9.9 is amount of provided currency for 1 coin of provided cryptocurrency

You can use Swagger UI to visualize everything via localhost:8000/docs