使用Python开发一个ICP备案查询接口

实现目标

  1. 支持通过域名、APP名称、快应用名称、小程序名称来查询对应的备案信息
  2. 支持通过公司主体名称来查询所有备案信息,并支持分页查询
  3. 支持通过备案号来查询备案信息
  4. 构建一个高性能的模块
  5. 基于模块构建一个高性能的本地化Api,并提供更人性化的输出

效果预览

  1. 通过域名查询备案信息
    Input:
    curl http://127.0.0.1:16181/query/web?search=baidu.com
    
    Out:
    {
        "code": 200,
        "msg": "操作成功",
        "params": {
            "endRow": 0,
            "firstPage": 1,
            "hasNextPage": false,
            "hasPreviousPage": false,
            "isFirstPage": true,
            "isLastPage": true,
            "lastPage": 1,
            "list": [
                {
                    "contentTypeName": "",
                    "domain": "baidu.com",
                    "domainId": 10000245113,
                    "leaderName": "",
                    "limitAccess": "否",
                    "mainId": 282751,
                    "mainLicence": "京ICP证030173号",
                    "natureName": "企业",
                    "serviceId": 282911,
                    "serviceLicence": "京ICP证030173号-1",
                    "unitName": "北京百度网讯科技有限公司",
                    "updateRecordTime": "2023-08-15 11:32:09"
                }
            ],
            "navigatePages": 8,
            "navigatepageNums": [
                1
            ],
            "nextPage": 1,
            "pageNum": 1,
            "pageSize": 10,
            "pages": 1,
            "prePage": 1,
            "size": 1,
            "startRow": 0,
            "total": 1
        },
        "success": true
    }
    
  2. 通过备案号来查询备案信息
    Input:
    curl http://127.0.0.1:16181/query/web?search=京ICP证030173号-1
    
    Out:
    	{
        "code": 200,
        "msg": "操作成功",
        "params": {
            "endRow": 0,
            "firstPage": 1,
            "hasNextPage": false,
            "hasPreviousPage": false,
            "isFirstPage": true,
            "isLastPage": true,
            "lastPage": 1,
            "list": [
                {
                    "contentTypeName": "",
                    "domain": "baidu.com",
                    "domainId": 10000245113,
                    "leaderName": "",
                    "limitAccess": "否",
                    "mainId": 282751,
                    "mainLicence": "京ICP证030173号",
                    "natureName": "企业",
                    "serviceId": 282911,
                    "serviceLicence": "京ICP证030173号-1",
                    "unitName": "北京百度网讯科技有限公司",
                    "updateRecordTime": "2023-08-15 11:32:09"
                }
            ],
            "navigatePages": 8,
            "navigatepageNums": [
                1
            ],
            "nextPage": 1,
            "pageNum": 1,
            "pageSize": 10,
            "pages": 1,
            "prePage": 1,
            "size": 1,
            "startRow": 0,
            "total": 1
        },
        "success": true
    }
    
  3. 在代码中使用
    import asyncio
    from ymicp import beian
    
    async def main(name):
        icp = beian()
        query = await icp.ymApp(name)
        print(query)
    
    asyncio.run(main("微信"))
    
  4. 使用本地化Api
    Linux下
    ./icpApi.bin
    
    Windows下
    # 可直接双击运行
    ./icpApi.exe
    

完整代码以及程序下载

  1. 完整代码已开源到Github项目 ICP_Query
    https://github.com/HG-ha/ICP_Query
  2. Linux程序下载
    https://github.com/HG-ha/ICP_Query/releases/download/v0.2-icpApi/linux_icpApi.zip
  3. Windows程序下载
    https://github.com/HG-ha/ICP_Query/releases/download/v0.2-icpApi/windows_icpApi.zip

在线Api接口

https://api.wer.plus/inteface?id=6

更多免费Api推荐

一铭Api: api.wer.plus