Simple Python script that retrieves and parses foreign-exchange rates published inside a JavaScript file on the National Bank of Malawi’s website
# **NatBank Exchange Rate Scraper**
A simple Python script that retrieves and parses foreign-exchange rates published inside a JavaScript file on the National Bank of Malawi’s website.
## **How It Works**
* Downloads the bank’s `headline.js` file containing exchange-rate data
* Extracts:
* Currency name
* Mapped currency code (USD, GBP, ZAR, etc.)
* Buying rate
* Selling rate
* Outputs the parsed data in a clean, readable format
---
## **Requirements**
* Python 3.x
* `requests` library
Install dependencies (if needed):
```bash
pip install requests
```
---
## **Usage**
Run the script:
```bash
python3 "Get NBM Exchange Rates.py"
```
Example output:
```
USD 1700.1234 1715.5678
GBP 2100.0000 2124.4444
...
```
---
## **Notes**
* The data format on the source website may change, so parsing logic might need adjustments.