Skip to main content

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

Project description

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"
        }
    ]
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyunit_idcard-2020.6.22.tar.gz (59.7 kB view details)

Uploaded Source

Built Distribution

pyunit_idcard-2020.6.22-py3-none-any.whl (66.1 kB view details)

Uploaded Python 3

File details

Details for the file pyunit_idcard-2020.6.22.tar.gz.

File metadata

  • Download URL: pyunit_idcard-2020.6.22.tar.gz
  • Upload date:
  • Size: 59.7 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for pyunit_idcard-2020.6.22.tar.gz
Algorithm Hash digest
SHA256 24718ce2dd315317c30a2d00c689ac4d3afb1341cb16ccf51d51ff8fb947347c
MD5 a081018f1ecaf52c20439cd73e74ea1f
BLAKE2b-256 2d6b74098fa1eb1bc2b1051f6c20a82cb508b87c64b24b50680540761c1e4c3b

See more details on using hashes here.

File details

Details for the file pyunit_idcard-2020.6.22-py3-none-any.whl.

File metadata

  • Download URL: pyunit_idcard-2020.6.22-py3-none-any.whl
  • Upload date:
  • Size: 66.1 kB
  • Tags: Python 3
  • Uploaded using 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

File hashes

Hashes for pyunit_idcard-2020.6.22-py3-none-any.whl
Algorithm Hash digest
SHA256 d0ae6d74d88313bf4074ba98e49c63676119977c386e06481ff1f38c67931166
MD5 fdb3f99493cc968abb3acf8e0980a9f1
BLAKE2b-256 814be87d11d54d6e3bb4917194c8e1d9809643b5beb7057cd4714f2646898317

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page