A Python package that identifies a Tanzanian phone number with respect to the mobile network (carrier).
In Tanzania, it can be challenging to identify which mobile network a phone number belongs to. This can be especially important for various services that rely on knowing the carrier, such as billing, sending cash, customer support, or mobile-specific features.
- Vodacom
- Tigo
- Airtel
- Halotel
- Zantel
- Smile
The author conducted intensive research and came across useful resources:
- Wikipedia article on Tanzanian phone numbers
- Wikipedia article on Telephone numbers in Tanzania
- Jamii Forums thread on identifying phone numbers by network
You can install the nambazasimu
package via pip:
pip install nambazasimu
To use the package, you can import the identify_carrier
function and pass a Tanzanian phone number to it. Here's a simple example:
from nambazasimu.carrier_identifier import identify_carrier
print(identify_carrier("+255684567890")) # Output: Airtel
print(identify_carrier("255754567890")) # Output: Voda
print(identify_carrier("0714567890")) # Output: Tigo
If you'd like to contribute to this project, follow these steps:
-
Fork the repo: Click the "Fork" button at the top right of the repository page.
-
Clone the forked repo:
git clone https://github.com/<yourusername>/nambazasimu.git
-
Navigate to the project directory:
cd nambazasimu
-
Set up a Python environment and install the requirements:
python -m venv venv source venv/bin/activate # On Windows use `venv\Scripts\activate` pip install -r requirements.txt
-
Make your changes, and be sure to write tests if necessary.
-
Commit your changes:
git add . git commit -m "Description of your changes"
-
Push your changes to your fork:
git push origin your-branch-name
-
Raise a Pull Request: Go to the original repository and create a new pull request.
This package won't work if a phone number has undergone Mobile Number Portability .
Mobile Number Portability (MNP) is a telecommunications feature that allows mobile phone users to retain their phone numbers when switching from one mobile network operator to another.
If you encounter any issues, please report them via the GitHub issues page. Provide as much detail as possible about the issue, including any error messages and steps to reproduce the problem.
This project is licensed under the MIT License. See the LICENSE file for more details.
- Wikipedia article on Tanzanian phone numbers
- Wikipedia article on Telephone numbers in Tanzania
- Jamii Forums thread on identifying phone numbers by network
Here are some more examples of how to use the package:
from nambazasimu.carrier_identifier import identify_carrier
print(identify_carrier("+255625567890")) # Output: Halotel
print(identify_carrier("255774567890")) # Output: Zantel
print(identify_carrier("0734567890")) # Output: TTCL
print(identify_carrier("+255123456789")) # Output: Unknown
Feel free to reach out if you have any questions or need further assistance!
Author: Alex Mkwizu Email : alexgmkwizu@gmail.com | @genie360s