用于护照、签证、身份证和其他旅行证件的机器可读区域生成器和检查器
项目描述
描述:
用于官方旅行证件尺寸 1、2、3、MRVA 和 MRVB(护照、签证、国民身份证和其他旅行证件)的机读区域生成器和检查器
MRZ Generator 和 MRZ Checker 是根据国际民用航空组织规范 (ICAO 9303) 建造的:
查看所有 9303 ICAO 文档(البيت العربي ,中文, English , Français , Русский和Español)
公务旅行证件的领域分布:
<图>图片
</figcaption> </figure>使用生成器:
TD1(身份证):
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(护照)
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(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(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.
护照生成器示例(ICAO9303 样本):
<图>图片
</figcaption> </figure>TD3CodeGenerator -> str:
from mrz.generator.td3 import TD3CodeGenerator
code = TD3CodeGenerator("P", "UTO", "Eriksson", "Anna María", "L898902C3", "UTO", "740812", "F", "120415","ZE184226B")
print(code)
输出:
P<UTOERIKSSON<<ANNA<MARIA<<<<<<<<<<<<<<<<<<< L898902C36UTO7408122F1204159ZE184226B<<<<<10
使用检查器:
TD1(身份证):
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(护照):
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
身份证检查器示例
<图>图片
</figcaption> </figure>TD1CodeChecker -> 布尔
from mrz.checker.td1 import TD1CodeChecker
check = TD1CodeChecker("I<SWE59000002<8198703142391<<<\n"
"8703145M1701027SWE<<<<<<<<<<<8\n"
"SPECIMEN<<SVEN<<<<<<<<<<<<<<<<")
result = bool(check)
print(result)
输出
True
注意:请参阅mrz.checker 示例文件夹中的其他用途
字段提取示例(适用于 td1、td2、td3 和 visas)
from mrz.checker.td1 import TD1CodeChecker, get_country
td1_check = TD1CodeChecker("IDLIEID98754015<<<<<<<<<<<<<<<\n"
"8205122M1906224LIE<<<<<<<<<<<6\n"
"OSPELT<BECK<<MARISA<<<<<<<<<<<")
fields = td1_check.fields()
print(fields.name, fields.surname)
print(get_country(fields.country))
输出
MARISA OSPELT BECK Liechtenstein
注意:请参阅mrz.checker 示例文件夹中的其他用途和此问题
安装:
来自Pypi repo(它可能不是最新版本):
pip install mrz
克隆这个 repo(它可能无法正常工作):
git clone https://github.com/Arg0s1080/mrz.git cd mrz sudo python3 setup.py install
特征:
[x] 特殊拉丁字符的音译(acutes、tildes、diaeresis、graves、circumflex 等)
[x] 阿拉伯字符音译
[x] 添加了几个西里尔文变体:塞尔维亚语、马其顿语、白俄罗斯语、乌克兰语和保加利亚语
[x] 现代希腊语的音译(实验性)
[x] 现代希伯来语的音译(无元音)(实验性)
[x] 从英文名称生成国家代码(例如:“Netherlands” -> “NLD”)
[x] 名称截断检测
[x] Checker 中的错误报告、警告报告和完整报告。
[x] 在 Checker 中使用 compute_warnings 关键字将警告计算为错误的可能性。
[x] 可以禁用对国家代码、国籍和文档类型的检查,允许使用国家字典中未包含的 3 字母代码,并在生成器中不受限制地使用 document_type 代码。
[x] 在 Checker 中添加了新的时间段检查。
[x] 签证支持
[x] 检查器中的字段提取(姓名、姓氏、国家、性别等)(0.5.0 版)
去做:
[ ] 生成器中的自动名称截断
[ ] 可以禁用检查器中国家代码、国籍、文件类型和其他字段的检查。
[]添加日志
项目详情
下载文件
下载适用于您平台的文件。如果您不确定要选择哪个,请了解有关安装包的更多信息。