Super simple Python API for fetching cryptocurrency exchange rate via Google Search.
Written with FastAPI and scraping via BeautifulSoup4.
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.
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}¤cy={value} |
Replace {value} correspondingly toquery 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