Skip to main content

PyUnit-IDCard

身份证实体抽取,身份证补全,身份证检测等功能。

安装

pip install pyunit-idcard

使用

from pyunit_idcard import IdCard

card = IdCard()


def check_up():
    """检验身份证正确性"""
    assert card.check_up('522121199505307051') is True


def find_card():
    """查询身份证信息测试"""
    assert card.find_card('522121199505307051') == {'发证地': '贵州省遵义地区遵义县', '出生日期': '1995年05月30日', '性别': '男'}


def complete_information():
    """补全身份证测试"""
    assert card.complete_information('522121*99505307051') == ['522121199505307051']

def match_card():
    """寻找身份证测试"""
    assert card.match_card('我的身份证信息是5**121199505*07051你能猜出来吗') == [
        {'发证地': '贵州省遵义地区遵义县', '出生日期': '1995年05月30日', '性别': '男', '身份证号码': '522121199505307051'},
        {'发证地': '云南省昆明市呈贡县', '出生日期': '1995年05月30日', '性别': '男', '身份证号码': '530121199505307051'},
        {'发证地': '西藏自治区拉萨市林周县', '出生日期': '1995年05月10日', '性别': '男', '身份证号码': '540121199505107051'}]


if __name__ == '__main__':
    check_up()
    find_card()
    match_card()
    complete_information()

Docker部署

docker pull jtyoui/pyunit-idcard
docker run -d -P jtyoui/pyunit-idcard

车牌号规则提取

参数名 类型 是否可以为空 说明
data string YES 输入话带有身份证,未知数可以用*来替代

请求示例

Python3 Requests测试

import requests

url = "http://IP:端口/pyunit/idCard"
data = {
    'data': '我的身份证信息是5**121199505*07051你能猜出来吗',
}
headers = {'Content-Type': "application/x-www-form-urlencoded"}
response = requests.post(url, data=data, headers=headers).json()
print(response)

返回结果

{
    "code":200,
    "result":[
        {
            "出生日期":"1995年05月30日",
            "发证地":"贵州省遵义地区遵义县",
            "性别":"男",
            "身份证号码":"522121199505307051"
        },
        {
            "出生日期":"1995年05月30日",
            "发证地":"云南省昆明市呈贡县",
            "性别":"男",
            "身份证号码":"530121199505307051"
        },
        {
            "出生日期":"1995年05月10日",
            "发证地":"西藏自治区拉萨市林周县",
            "性别":"男",
            "身份证号码":"540121199505107051"
        }
    ]
}

Metadata

Release files for pyunit-idcard 2020.6.22

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

Source distribution (sdist)

Source distribution for pyunit-idcard 2020.6.22
File Size Uploaded Provenance
pyunit_idcard-2020.6.22.tar.gz 59.7 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for pyunit-idcard 2020.6.22
File Interpreter ABI Platform
pyunit_idcard-2020.6.22-py3-none-any.whl Python 3 none any Details

Total release size: 125.8 kB

Release files / pyunit_idcard-2020.6.22.tar.gz

Download URL pyunit_idcard-2020.6.22.tar.gz
Size 59.7 kB
Tags Source
SHA-256 checksum
How to use checksums
24718ce2dd315317c30a2d00c689ac4d3afb1341cb16ccf51d51ff8fb947347c
BLAKE2b-256 checksum
How to use checksums
2d6b74098fa1eb1bc2b1051f6c20a82cb508b87c64b24b50680540761c1e4c3b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.24.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.3

Release files / pyunit_idcard-2020.6.22-py3-none-any.whl

Download URL pyunit_idcard-2020.6.22-py3-none-any.whl
Size 66.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d0ae6d74d88313bf4074ba98e49c63676119977c386e06481ff1f38c67931166
BLAKE2b-256 checksum
How to use checksums
814be87d11d54d6e3bb4917194c8e1d9809643b5beb7057cd4714f2646898317
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.24.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.3

Security for pyunit-idcard 2020.6.22

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

2020.6.22 This release

2 release files No provenance

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