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 details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

Details for the file telcolib-0.2.tar.gz.

File metadata

  • Download URL: telcolib-0.2.tar.gz
  • Upload date:
  • Size: 16.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.12.0

File hashes

Hashes for telcolib-0.2.tar.gz
Algorithm Hash digest
SHA256 ec184db91e10f59fa2a367d9884cca71d7b7b2e1f121cf7617ec7a9c122ce745
MD5 07eac74a27752c49ff4cce47659c71fe
BLAKE2b-256 30ebe94619836457f298d7de084bc572b68f3a4b36c4920fe80628618c0994d3

See more details on using hashes here.

File details

Details for the file telcolib-0.2-py3-none-any.whl.

File metadata

  • Download URL: telcolib-0.2-py3-none-any.whl
  • Upload date:
  • Size: 17.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.12.0

File hashes

Hashes for telcolib-0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 b3a0b771c7a99282ffb6c1597401c9a28e9115c0fc7a05807fec298286cddb6f
MD5 5d49102b9f017ab50324e08fbdbec528
BLAKE2b-256 a8d8f7440c0c43b5e4348b6c9243b7a16e15d5690e887d79513711d106e53b6e

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