手机号码SQLite数据库
Project description
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月)
数据来源
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
phone-db-1.0.3.tar.gz
(5.2 MB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file phone-db-1.0.3.tar.gz.
File metadata
- Download URL: phone-db-1.0.3.tar.gz
- Upload date:
- Size: 5.2 MB
- Tags: Source
- Uploaded using 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
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2252cae09fa4c6be07002af856f585036d323802ed337de0f9f8edcfced5d5ea
|
|
| MD5 |
ba69adf658c52175e96f5481d41884d6
|
|
| BLAKE2b-256 |
fc92c62424c512d001ade86efdccc92a0c795e1fca3e2df93e7c937e8177be70
|
File details
Details for the file phone_db-1.0.3-py3-none-any.whl.
File metadata
- Download URL: phone_db-1.0.3-py3-none-any.whl
- Upload date:
- Size: 5.2 MB
- Tags: Python 3
- Uploaded using 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
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5aa75a01cfb43a4e6f376fb1143c5a2e88c66a89f14754139435ba902b686045
|
|
| MD5 |
e61deae163db28c307a3bebffbdd3334
|
|
| BLAKE2b-256 |
c7493635bc5672841641556221e0066b85b37d0b2d295f46678242f9139263d4
|