Skip to main content

A phone number validation library for multiple countries

Project description

telcolib

Overview

telcolib is a Python library designed for validating phone numbers across multiple countries. Utilizing regular expressions, it ensures phone numbers adhere to specific national formats.

Features

  • Validates phone numbers from a wide range of countries.
  • Easily extendable to include additional countries and formats.
  • Simple, straightforward API.

Installation

To install telcolib, run the following command:

pip install telcolib

Alternatively, you can clone the repository and install it manually:

git clone https://github.com/copyleftdev/telcolib.git
cd telcolib
pip install .

Usage

Here's a quick example of how to use telcolib:

from telcolib import PhoneNumberValidator

# Create an instance of the validator
validator = PhoneNumberValidator()

# Validate a phone number
valid = validator.validate('+14445556666', 'USA')
print("Phone number is valid:", valid)

Adding Custom Patterns

To add or update a country's phone number pattern:

validator.add_country_pattern('CountryName', r'^\+CountryCode\d{NumberOfDigits}$')

Development

Prerequisites

  • Python 3.6 or higher.

Setting Up a Development Environment

  1. Clone the repository:

    git clone https://github.com/copyleftdev/telcolib.git
    
  2. Navigate to the project directory:

    cd telcolib
    
  3. Install the dependencies:

    pip install -r requirements.txt
    

Running Tests

To run the tests, execute:

pytest tests/

Contributing

Contributions to telcolib are welcome! Feel free to fork the repository and submit pull requests.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Contact

For questions or feedback related to telcolib, please open an issue in the GitHub repository.

Project details


Download files

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

Source Distribution

telcolib-0.2.tar.gz (16.5 kB view hashes)

Uploaded Source

Built Distribution

telcolib-0.2-py3-none-any.whl (17.1 kB view hashes)

Uploaded Python 3

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