We built a REST API to manage Mobile Money transaction records from SMS data. It's written in pure Python (no Flask or Django) and includes all the CRUD endpoints with authentication. We also compared different data structure search methods to see which is faster.
- Built the main API server with routing and all the HTTP handlers
- Implemented PUT and DELETE endpoints - took a while to get the error codes right
- Created the DSA comparison tool to benchmark linear search vs dictionary lookup
- Helped debug issues across the project
- Parsed the XML transaction data and converted it to JSON
- Designed the data structures we use for storing transactions
- Implemented the GET endpoints (both list all and get by ID)
- Created the authentication module with Basic Auth
- Handled all the authorization header parsing
- Wrote up security concerns (we know Basic Auth isn't perfect but it works for this)
- Built the POST endpoint for creating new transactions
- Added validation to make sure bad data doesn't get in
- Created all the test scripts so we could verify everything works
- Wrote the API documentation with examples
- Put together the README and setup instructions
- Coordinated integration between all our parts
- Python 3.7+ (we tested on 3.10)
- curl or Postman to test it
- Get the code
git clone <repository-url>
cd momo-api-project-
That's it! No pip install needed - we only used Python's standard library
-
Start the server
python api/server.pyServer runs on http://localhost:8000
- Try it out
# Get all transactions (you need to login)
curl -u admin:password http://localhost:8000/transactions
# Get one transaction
curl -u admin:password http://localhost:8000/transactions/1
# Add a new transaction
curl -u admin:password -X POST http://localhost:8000/transactions \
-H "Content-Type: application/json" \
-d '{"type":"Send Money","amount":5000,"sender":"250780000001","receiver":"250780000002"}'momo-api-project/
├── api/
│ ├── server.py # Main API server (Teniola)
│ └── auth.py # Authentication logic (Michaella)
├── dsa/
│ ├── parser.py # XML parsing (Kevin)
│ └── search_comparison.py # DSA analysis (Teniola)
├── docs/
│ └── api_docs.md # API documentation (Kamunuga)
├── data/
│ └── modified_sms_v2.xml # Sample data
├── screenshots/
│ └── README.md # Test screenshots guide
├── tests/
│ └── test_api.sh # Test scripts (Rajveer)
└── README.md # This file (Kamunuga)
GET /transactions- Get all transactionsGET /transactions/{id}- Get one specific transactionPOST /transactions- Create a new onePUT /transactions/{id}- Update an existing transactionDELETE /transactions/{id}- Remove a transaction
Check docs/api_docs.md for more details and examples.
Username: admin
Password: password
Yeah we know Basic Auth isn't the most secure but it's fine for this project
Want to see how much faster dictionary lookup is than linear search?
python dsa/search_comparison.pySpoiler: dictionaries are WAY faster (like 30x)