phone-db
手机号码归属地SQLite数据库
安装
pip install phone-db
使用:
查询数据库中手机号段总条数
>>> from phone_db import Session, Phone, Region
>>> session = Session()
>>> session.query(Phone).count()
415284
查询北京市联通手机号段总条数
>>> city = session.query(Region).filter_by(zip_code='100000').first()
>>> if city:
... city.phones.filter_by(type=2).count()
...
6355
查询指定手机号段归属地信息
>>> num = session.query(Phone).filter_by(number=1761166).first()
>>> if num:
... num.detail()
...
(1761166, '联通', {'province': '北京', 'city': '北京', 'zip_code': '100000', 'area_code': '010'})
数据表结构
phones表
id INTEGER NOT NULL,
number INTEGER,
type INTEGER,
region_id INTEGER,
PRIMARY KEY (id),
FOREIGN KEY(region_id) REFERENCES regions (id)
regions表
id INTEGER NOT NULL,
province VARCHAR,
city VARCHAR,
zip_code VARCHAR,
area_code VARCHAR,
PRIMARY KEY (id)
phones表type字段卡类型定义
* 1 移动
* 2 联通
* 3 电信
* 4 电信虚拟运营商
* 5 联通虚拟运营商
* 6 移动虚拟运营商
数据可视化
下载phone.db文件,使用sqlitebrowser查看
记录条数
415284 (updated:2019年2月)
数据来源
Metadata
Release files for phone-db 1.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| phone-db-1.0.3.tar.gz | 5.2 MB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| phone_db-1.0.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 10.5 MB
Release files / phone-db-1.0.3.tar.gz
| Download URL | phone-db-1.0.3.tar.gz |
|---|---|
| Size | 5.2 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2252cae09fa4c6be07002af856f585036d323802ed337de0f9f8edcfced5d5ea
|
|
BLAKE2b-256 checksum How to use checksums |
fc92c62424c512d001ade86efdccc92a0c795e1fca3e2df93e7c937e8177be70
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.8
|
Release files / phone_db-1.0.3-py3-none-any.whl
| Download URL | phone_db-1.0.3-py3-none-any.whl |
|---|---|
| Size | 5.2 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5aa75a01cfb43a4e6f376fb1143c5a2e88c66a89f14754139435ba902b686045
|
|
BLAKE2b-256 checksum How to use checksums |
c7493635bc5672841641556221e0066b85b37d0b2d295f46678242f9139263d4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.8
|