Machine Readable Zone generator and checker for official travel
documents sizes 1, 2, 3, MRVA and MRVB (Passports, Visas, national id
cards and other travel documents)
MRZ Generator and MRZ Checker are built according to International Civil
Aviation Organization specifications (ICAO 9303):
Specifications Common to all Machine Readable Travel Documents (MRTDs) <https://www.icao.int/publications/Documents/9303_p3_cons_en.pdf>__
Specifications for Machine Readable Passports (MRPs) <https://www.icao.int/publications/Documents/9303_p4_cons_en.pdf>__
Specifications for TD1 Size Machine Readable Official Travel Documents (MROTDs) <https://www.icao.int/publications/Documents/9303_p5_cons_en.pdf>__
Specifications for TD2 Size Machine Readable Official Travel Documents (MROTDs) <https://www.icao.int/publications/Documents/9303_p6_cons_en.pdf>__
Specifications for Machine Readable Visas (MRV) <https://www.icao.int/publications/Documents/9303_p7_cons_en.pdf>__
See all 9303 ICAO docs (البيت العربي <https://github.com/Arg0s1080/mrz/tree/master/docs/ICAO9303/Arab/Files_ar.rst>, 中文 <https://github.com/Arg0s1080/mrz/tree/master/docs/ICAO9303/Chinese/Files_zh.rst>, English <https://github.com/Arg0s1080/mrz/tree/master/docs/ICAO9303/English/Files_en.rst>, Français <https://github.com/Arg0s1080/mrz/tree/master/docs/ICAO9303/French/Files_fr.rst>, Русский <https://github.com/Arg0s1080/mrz/tree/master/docs/ICAO9303/Russian/Files_ru.rst>__ and Español <https://github.com/Arg0s1080/mrz/tree/master/docs/ICAO9303/Spanish/Files_es.rst>__)
Params: Case insensitive
document_type (str): The first letter shall be 'I', 'A' or 'C'
country_code (str): 3 letters code (ISO 3166-1) or country name (in English)
document_number (str): Document number
birth_date (str): YYMMDD
sex (str): Genre. Male: 'M', Female: 'F' or Undefined: 'X', "<" or ""
expiry_date (str): YYMMDD
nationality (str): 3 letters code (ISO 3166-1) or country name (in English)
surname (str): Holder primary identifier(s). This field will be transliterated
given_names (str): Holder secondary identifier(s). This field will be transliterated
optional_data1 (str): Optional personal data at the discretion of the issuing State.
Non-mandatory field. Empty string by default
optional_data2 (str): Optional personal data at the discretion of the issuing State.
Non-mandatory field. Empty string by default
transliteration (dict): Transliteration dictionary for non-ascii chars. Latin based by default
force (bool): Disables checks for country, nationality and document_type fields.
Allows to use 3-letter-codes not included in the countries dictionary
and to use document_type codes without restrictions.
TD2
^^^
::
Params: Case insensitive
document_type (str): The first letter shall be 'I', 'A' or 'C'
country_code (str): 3 letters code (ISO 3166-1) or country name (in English)
surname (str): Holder primary identifier(s). This field will be transliterated.
given_names (str): Holder secondary identifier(s). This field will be transliterated.
document_number (str): Document number.
nationality (str): 3 letters code (ISO 3166-1) or country name
birth_date (str): YYMMDD
sex (str): Genre. Male: 'M', Female: 'F' or Undefined: 'X', "<" or ""
expiry_date (str): YYMMDD
optional_data (str): Optional personal data at the discretion of the issuing State.
Non-mandatory field. Empty string by default
transliteration (dict): Transliteration dictionary for non-ascii chars. Latin based by default
force (bool): Disables checks for country, nationality and document_type fields.
Allows to use 3-letter-codes not included in the countries dictionary
and to use document_type codes without restrictions.
TD3 (Passports)
^^^^^^^^^^^^^^^
::
Params: Case insensitive
document_type (str): Normally 'P' for passport
country_code (str): 3 letters code (ISO 3166-1) or country name (in English)
surname (str): Primary identifier(s)
given_names (str): Secondary identifier(s)
document_number (str): Document number
nationality (str): 3 letters code (ISO 3166-1) or country name
birth_date (str): YYMMDD
sex (str): Genre. Male: 'M', Female: 'F' or Undefined: 'X', "<" or ""
expiry_date (str): YYMMDD
optional data (str): Personal number. In some countries non-mandatory field. Empty string by default
transliteration (dict): Transliteration dictionary for non-ascii chars. Latin based by default
force (bool): Disables checks for country, nationality and document_type fields.
Allows to use 3-letter-codes not included in the countries dictionary
and to use document_type codes without restrictions.
MRVA (Visas type A)
^^^^^^^^^^^^^^^^^^^
::
Params: Case insensitive
document_type (str): The First letter must be 'V'
country_code (str): 3 letters code (ISO 3166-1) or country name (in English)
surname (str): Primary identifier(s)
given_names (str): Secondary identifier(s)
document_number (str): Document number
nationality (str): 3 letters code (ISO 3166-1) or country name
birth_date (str): YYMMDD
sex (str): Genre. Male: 'M', Female: 'F' or Undefined: 'X', "<" or ""
expiry_date (str): YYMMDD
optional_data (str): Optional personal data at the discretion of the issuing State.
Non-mandatory field. Empty string by default.
transliteration (dict): Transliteration dictionary for non-ascii chars. Latin based by default
force (bool): Disables checks for country, nationality and document_type fields.
Allows to use 3-letter-codes not included in the countries dictionary
and to use document_type codes without restrictions.
MRVB (Visas type B)
^^^^^^^^^^^^^^^^^^^
::
Params: Case insensitive
document_type (str): The First letter must be 'V'
country_code (str): 3 letters code (ISO 3166-1) or country name (in English)
surname (str): Primary identifier(s)
given_names (str): Secondary identifier(s)
document_number (str): Document number
nationality (str): 3 letters code (ISO 3166-1) or country name
birth_date (str): YYMMDD
sex (str): Genre. Male: 'M', Female: 'F' or Undefined: 'X', "<" or ""
expiry_date (str): YYMMDD
optional_data (str): Optional personal data at the discretion of the issuing State.
Non-mandatory field. Empty string by default.
transliteration (dict): Transliteration dictionary for non-ascii chars. Latin based by default
force (bool): Disables checks for country, nationality and document_type fields.
Allows to use 3-letter-codes not included in the countries dictionary
and to use document_type codes without restrictions.
Passport generator example (ICAO9303 Specimen):
'''''''''''''''''''''''''''''''''''''''''''''''
Note: See other uses in mrz.generator examples folder <https://github.com/Arg0s1080/mrz/tree/master/examples/mrz_generator_samples>__
Usage Checker:
TD1's (id cards):
^^^^^^^^^^^^^^^^^
::
Params:
mrz_string (str): MRZ string of TD1. Must be 90 uppercase characters long (3 lines)
check_expiry (bool): If it's set to True, it is verified and reported as warning that the
document is not expired and that expiry_date is not greater than 10 years
compute_warnings (bool): If it's set True, warnings compute as False
TD2:
^^^^
::
Params:
mrz_string (str): MRZ string of TD2. Must be 72 characters long (uppercase) (2 lines)
check_expiry (bool): If it's set to True, it is verified and reported as warning that the
document is not expired and that expiry_date is not greater than 10 years
compute_warnings (bool): If it's set True, warnings compute as False
TD3 (Passports):
^^^^^^^^^^^^^^^^
::
Params:
mrz_string (str): MRZ string of TD3. Must be 88 characters long (uppercase) (2 lines)
check_expiry (bool): If it's set to True, it is verified and reported as warning that the
document is not expired and that expiry_date is not greater than 10 years
compute_warnings (bool): If it's set True, warnings compute as False
MRVA:
^^^^^
::
Params:
mrz_string (str): MRZ string of Visas type A. Must be 88 characters long (uppercase) (2 lines)
check_expiry (bool): If it's set to True, it is verified and reported as warning that the
document is not expired and that expiry_date is not greater than 10 years
compute_warnings (bool): If it's set True, warnings compute as False
MRVB:
^^^^^
::
Params:
mrz_string (str): MRZ string of Visas type B. Must be 72 characters long (uppercase) (2 lines)
check_expiry (bool): If it's set to True, it is verified and reported as warning that the
document is not expired and that expiry_date is not greater than 10 years
compute_warnings (bool): If it's set True, warnings compute as False
Note: See other uses in mrz.checker examples folder <https://github.com/Arg0s1080/mrz/tree/master/examples/mrz_checker_samples>__ and this issue <https://github.com/Arg0s1080/mrz/issues/6>__
Installation:
From Pypi repo <https://pypi.org/project/mrz/>__ (It may not be the latest version):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
::
pip install mrz
Cloning this repo (It may not work fine):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
::
git clone https://github.com/Arg0s1080/mrz.git
cd mrz
sudo python3 setup.py install
Features:
Transliteration of special Latin characters (acutes, tildes,
diaeresis, graves, circumflex, etc)
Arabic chars transliteration
Several variations of Cyrillic added: Serbian, Macedonian,
Belarusian, Ukrainian and Bulgarian
Transliteration of modern Greek (experimental)
Transliteration of modern Hebrew (without vowels) (experimental)
Generation of the country code from its name in English (Ex.:
"Netherlands" -> "NLD")
Name truncation detection
Error report, warnings report and full report in Checker.
Possibility that warnings compute as errors using
compute_warnings keyword in Checker.
Possibility of disabling checks for country code, nationality and
type of document, allowing to use 3-letter-codes not included in the
countries dictionary and to use document_type codes without
restrictions in Generator.
Machine readable zone generator and checker for passports, visas, id cards and other travel documents
We found that mrz demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago.It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Socket and Seal Security collaborate to fix a critical npm overrides bug, resolving a three-year security issue in the JavaScript ecosystem's most popular package manager.
TypeScript is porting its compiler to Go, delivering 10x faster builds, lower memory usage, and improved editor performance for a smoother developer experience.
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.