Skip to main content

Python Class to validate a Nigerian phone number as well as attempt to deduce the network

Project description

HitCount CircleCI

Issues and pull requests welcome.

A Python module to validate and format a Nigerian phone number as well as deduce the network provider or area code.

Table of Contents

Installation

You will need Python 3.x and pip.

Install using pip: pip install validate_nigerian_phone Install via repo:

  • Clone repo git clone https://github.com/djunehor/validate_nigerian_phone

  • Place validate_nigerian_phone in your project root folder

Usage

from validate_nigerian_phone import NigerianPhone

phone = NigerianPhone('+2348135087966')

# Check if is valid
phone.is_valid() #True

# Get formatted
phone.formatted() #08135087966

# Get Network
phone.get_network() #mtn

# Check if is mtn
phone.is_mtn() # True


# Get network from phone number prefix e.g
phone.get_network_by_prefix('0703') # mtn

Features

Currently implemented

  • is_valid

  • formatted

  • get_network

  • get_area_code

  • is_mtn

  • is_glo

  • is_airtel

  • is_9mobile

  • is_smile

  • is_smile

  • is_multilinks

  • is_visafone

  • is_ntel

  • is_starcomms

  • is_zoom

  • get_prefixes_by_network

  • get_network_by_prefix

  • get_area_code_by_name

Tests

  • Run python tests.py

Contribute

Check out the issues on GitHub and/or make a pull request to contribute!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

validate_nigerian_phone-1.0.0-py3-none-any.whl (5.6 kB view details)

Uploaded Python 3

File details

Details for the file validate_nigerian_phone-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: validate_nigerian_phone-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 5.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.0

File hashes

Hashes for validate_nigerian_phone-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c770cc32799b1b0aad48725faba9086c3d534b4df1f99e6f19a75de1edcb0759
MD5 697be86321df5f70a2b32d90fd9a9cee
BLAKE2b-256 759f35532aa9ea51379c56476182575a998adb502bf3e7face8d42874c8b615b

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page