py-phone-number-fmt


Namepy-phone-number-fmt JSON
Version 1.1 PyPI version JSON
download
home_pagehttps://github.com/SectorLabs/py-phone-number-fmt
SummarySanitize, validate and format phone numbers into E.164 valid phone numbers.
upload_time2019-11-03 07:17:43
maintainer
docs_urlNone
authorSector Labs
requires_python
licenseMIT License
keywords phone number phone formatting validation
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage
            # py-phone-number-fmt

[![License](https://img.shields.io/:license-mit-blue.svg)](http://doge.mit-license.org)
[![PyPi](https://badge.fury.io/py/py-phone-number-fmt.svg)](https://pypi.python.org/pypi/py-phone-number-fmt)
[![CircleCI](https://circleci.com/gh/SectorLabs/py-phone-number-fmt/tree/master.svg?style=svg&circle-token=134c614a21ff3a5ca674d34d67d3b65b429b86d8)](https://circleci.com/gh/SectorLabs/py-phone-number-fmt/tree/master)

Sanitize, validate and format phone numbers into E.164 valid phone numbers.

Google's libphonenumber on steroids. Tries all sorts of crazy combinations in an attempt to create a valid phone number. Useful for those of us who have to deal with poorly sanitized data.

[See the list of test cases](./tests/test_format_phone_number.py)

## Installation

    $ pip install py-phone-number-fmt

## Usage

    from phonenumberfmt import format_phone_number

    # implied phone region is the country of which to
    # use the dialing prefix in case the number appears
    # to be local
    result = format_phone_number('778\173 0.92', implied_phone_region='RO')
    assert result == '+40778173092'

The resulting phone number will be formatted according to the E.164 standard. Want to change the output format? Pass the third, optional parameter `fmt` with a valid member of `phonenumbers.NumberFormat`:

    from phonenumbers import NumberFormat
    result = format_phone_number(
        '778\173 0.92',
        implied_phone_region='RO',
        fmt=NumberFormat.INTERNATIONAL, # default is NumberFormat.E164
    )
            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/SectorLabs/py-phone-number-fmt",
    "name": "py-phone-number-fmt",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "phone number,phone,formatting,validation",
    "author": "Sector Labs",
    "author_email": "open-source@sectorlabs.ro",
    "download_url": "https://files.pythonhosted.org/packages/1a/1f/7a35aa922d4389cac6f5eda6b14197d74c0168d017b2b0a14164d1a1edb4/py-phone-number-fmt-1.1.tar.gz",
    "platform": "",
    "description": "# py-phone-number-fmt\n\n[![License](https://img.shields.io/:license-mit-blue.svg)](http://doge.mit-license.org)\n[![PyPi](https://badge.fury.io/py/py-phone-number-fmt.svg)](https://pypi.python.org/pypi/py-phone-number-fmt)\n[![CircleCI](https://circleci.com/gh/SectorLabs/py-phone-number-fmt/tree/master.svg?style=svg&circle-token=134c614a21ff3a5ca674d34d67d3b65b429b86d8)](https://circleci.com/gh/SectorLabs/py-phone-number-fmt/tree/master)\n\nSanitize, validate and format phone numbers into E.164 valid phone numbers.\n\nGoogle's libphonenumber on steroids. Tries all sorts of crazy combinations in an attempt to create a valid phone number. Useful for those of us who have to deal with poorly sanitized data.\n\n[See the list of test cases](./tests/test_format_phone_number.py)\n\n## Installation\n\n    $ pip install py-phone-number-fmt\n\n## Usage\n\n    from phonenumberfmt import format_phone_number\n\n    # implied phone region is the country of which to\n    # use the dialing prefix in case the number appears\n    # to be local\n    result = format_phone_number('778\\173 0.92', implied_phone_region='RO')\n    assert result == '+40778173092'\n\nThe resulting phone number will be formatted according to the E.164 standard. Want to change the output format? Pass the third, optional parameter `fmt` with a valid member of `phonenumbers.NumberFormat`:\n\n    from phonenumbers import NumberFormat\n    result = format_phone_number(\n        '778\\173 0.92',\n        implied_phone_region='RO',\n        fmt=NumberFormat.INTERNATIONAL, # default is NumberFormat.E164\n    )",
    "bugtrack_url": null,
    "license": "MIT License",
    "summary": "Sanitize, validate and format phone numbers into E.164 valid phone numbers.",
    "version": "1.1",
    "project_urls": {
        "Homepage": "https://github.com/SectorLabs/py-phone-number-fmt"
    },
    "split_keywords": [
        "phone number",
        "phone",
        "formatting",
        "validation"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1a1f7a35aa922d4389cac6f5eda6b14197d74c0168d017b2b0a14164d1a1edb4",
                "md5": "425542234d3c5883154d4511fe3bc90c",
                "sha256": "92379ab23b29e22e693edecc13dd953189075ba8794da49b555b3735efb616e4"
            },
            "downloads": -1,
            "filename": "py-phone-number-fmt-1.1.tar.gz",
            "has_sig": false,
            "md5_digest": "425542234d3c5883154d4511fe3bc90c",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 4868,
            "upload_time": "2019-11-03T07:17:43",
            "upload_time_iso_8601": "2019-11-03T07:17:43.980000Z",
            "url": "https://files.pythonhosted.org/packages/1a/1f/7a35aa922d4389cac6f5eda6b14197d74c0168d017b2b0a14164d1a1edb4/py-phone-number-fmt-1.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2019-11-03 07:17:43",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "SectorLabs",
    "github_project": "py-phone-number-fmt",
    "travis_ci": false,
    "coveralls": true,
    "github_actions": false,
    "circle": true,
    "requirements": [],
    "tox": true,
    "lcname": "py-phone-number-fmt"
}
        
Elapsed time: 0.19952s