Skip to main content
https://travis-ci.com/anka-sirota/localflavor.svg?branch=master

localflavor

This package is a derivative of django-localflavor and a work in progress. This package does not depend on Django, and currently only contains postal codes validators, lists of country states and provinces and calling (dial in) codes.

Installation

pip install localflavor

Example usage

Postal code validation

>>> from localflavor.generic.validators import validate_country_postcode
>>> validate_country_postcode('1000AA', 'NL')
'1000 AA'
>>> validate_country_postcode('0888', 'US')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "../localflavor/generic/validators.py", line 453, in validate_country_postcode
    return validator.clean(value)
  File "../localflavor/base.py", line 71, in clean
    value = super(RegexValidator, self).clean(value)
  File "../localflavor/base.py", line 48, in clean
    raise ValidationError(self.error_messages['invalid'])
localflavor.exceptions.ValidationError: Enter a valid ZIP code in the format XXXXX or XXXXX-XXXX.

Calling codes

>>> from localflavor.generic.countries.calling_codes import CALLING_CODES
>>> CALLING_CODES.get('US')
'+1'
>>> CALLING_CODES.get('RU')
'+7'
>>> CALLING_CODES.get('NL')
'+31'

Metadata

Release files for localflavor 1.9

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for localflavor 1.9
File Size Uploaded
localflavor-1.9.tar.gz 79.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for localflavor 1.9
File Interpreter ABI Platform
localflavor-1.9-py3-none-any.whl Python 3 none any Details

Total release size: 203.3 kB

Release files / localflavor-1.9.tar.gz

Download URL localflavor-1.9.tar.gz
Size 79.9 kB
Tags Source
SHA-256 checksum
How to use checksums
b051be69c778d02754be4a1c447d73107d80330e261e2eb77e17780e41e49272
BLAKE2b-256 checksum
How to use checksums
631267fa0d311578aa90d4ba60bf8a567cc8b375b728589120a8a9e9aadc7048
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.6.12

Release files / localflavor-1.9-py3-none-any.whl

Download URL localflavor-1.9-py3-none-any.whl
Size 123.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
02820a541d5fd0317265b7bacbc6a30a19492decc97205620545e4ae8eb8689c
BLAKE2b-256 checksum
How to use checksums
64b335a6dfefcf4dd005c356dbdc783afbfa2d3d89441c3b4894ce593fd70b7d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.6.12

Release history Release notifications | RSS feed

This release

1.9 This release

2 release files

1.8

2 release files

1.7

2 release files

1.6

2 release files

1.5

2 release files

1.4

2 release files

1.3

2 release files

1.2

2 release files

1.1

2 release files

1.0

2 release files

0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page