A simple Python CLI tool that converts between 150+ currencies in real-time. Perfect for finance apps, e-commerce, or learning API integration with Python.
This tutorial requires an APIVerve API key. Sign up free - no credit card required.
- Convert between 150+ world currencies
- Real-time exchange rates
- Interactive CLI mode
- Command-line arguments for scripting
- Clean, readable Python code
- Minimal dependencies (just
requests)
-
Clone this repository
git clone https://github.com/apiverve/currency-converter-python-tutorial.git cd currency-converter-python-tutorial -
Install dependencies
pip install -r requirements.txt
-
Add your API key
Open
converter.pyand replace the placeholder with your API key:API_KEY = 'your-api-key-here'
-
Run the converter
Interactive mode:
python converter.py
Or with command-line arguments:
python converter.py 100 USD EUR
$ python converter.py
========================================
Currency Converter
Powered by APIVerve
========================================
Type 'quit' to exit
Amount to convert: 100
From currency (e.g., USD): USD
To currency (e.g., EUR): EUR
========================================
100.00 USD
= 92.65 EUR
========================================
Exchange Rate: 1 USD = 0.9265 EUR# Convert 100 USD to EUR
python converter.py 100 USD EUR
# Convert 50 GBP to JPY
python converter.py 50 GBP JPY
# Convert 1000 EUR to USD
python converter.py 1000 EUR USDcurrency-converter-python-tutorial/
├── converter.py # Main converter script
├── requirements.txt # Python dependencies
├── screenshot.jpg # Preview image
├── LICENSE # MIT license
├── .gitignore # Git ignore rules
└── README.md # This file
Endpoint: GET https://api.apiverve.com/v1/exchangerate
Query Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
currency1 |
string | Yes | Source currency code (e.g., "USD") |
currency2 |
string | Yes | Target currency code (e.g., "EUR") |
Example Response:
{
"status": "ok",
"error": null,
"data": {
"currency1": "USD",
"currency2": "EUR",
"exchangeRate": "0.926480"
}
}The API supports 150+ currencies including:
| Code | Currency |
|---|---|
| USD | US Dollar |
| EUR | Euro |
| GBP | British Pound |
| JPY | Japanese Yen |
| CAD | Canadian Dollar |
| AUD | Australian Dollar |
| CHF | Swiss Franc |
| CNY | Chinese Yuan |
| INR | Indian Rupee |
| MXN | Mexican Peso |
- Add a Flask web interface
- Cache exchange rates with TTL
- Add historical rate lookups
- Create a batch conversion mode
- Export results to CSV
- Add currency symbol formatting
Explore more APIs at APIVerve:
- Currency Converter - Direct currency conversion
- Gold Price - Current gold prices
- Silver Price - Current silver prices
MIT - see LICENSE
- Get API Key - Sign up free
- APIVerve Marketplace - Browse 300+ APIs
- Exchange Rate API - API details
