非官方 NBN API 包装器
项目描述
NBN-Py
此软件包提供了国家宽带网络 (NBN) API 的非官方包装器。它允许您以编程方式查找地址并检查连接详细信息,例如连接类型(FTTP、HFC 等)、服务类型、连接状态等。
免责声明: 此项目不隶属于 NBN。
安装
nbnpy
从 Python 包索引安装:
$ pip install nbnpy
要求
- Python 3.8+
用法
此示例获取地址的 LocationID,然后查找其 NBN 连接详细信息。
import pprint
from nbnpy.nbn import NBN
nbn_client = NBN()
location_ids = nbn_client.get_location_ids_from_address("1 Flinders Street, Melbourne VIC")
# The "get_location_ids_*" methods return a list of nearby locations
# For the purpose of this example, the first result will suffice
location_id = location_ids["suggestions"][0]["id"]
location_info = nbn_client.location_information(location_id)
pprint.pprint(location_info)
位置信息输出
{
"addressDetail": {
"TC2SME": true,
"address1": "Unit 1 32 Flinders St",
"address2": "Melbourne VIC 3000 Australia",
"altReasonCode": "NULL_NA",
"cbdpricing": true,
"coatChangeReason": "",
"disconnectionDate": "Sep 2020",
"disconnectionStatus": "PAST",
"ee": true,
"eec": 1,
"formattedAddress": "UNIT 1 32 FLINDERS ST MELBOURNE VIC 3000 Australia",
"frustrated": false,
"id": "LOC000175010671",
"latitude": -37.81540657,
"longitude": 144.97344433,
"reasonCode": "FTTC_SA",
"serviceStatus": "available",
"serviceType": "Fixed line",
"speedTierAvailability": true,
"techFlip": "",
"techType": "FTTC",
"wp1DisconnectionDate": "11 September 2020",
"wp1DisconnectionStatus": "PAST",
"wp2DisconnectionDate": "11 September 2020",
"wp2DisconnectionStatus": "PAST",
"wp3DisconnectionDate": "11 September 2020",
"wp3DisconnectionStatus": "PAST",
"wp4DisconnectionDate": "11 September 2020",
"wp4DisconnectionStatus": "PAST",
"zeroBuildCost": true
},
"servingArea": {
"csaId": "CSA300000010316",
"description": "Exhibition",
"rfsMessage": "Sep 2018",
"serviceCategory": "brownfields",
"serviceStatus": "available",
"serviceType": "Fixed line",
"techType": "FTTC"
},
"timestamp": 1654656817504
}
构建项目
这个包使用poetry
andnox
用于包管理和构建。
如果 nox 尚未安装,请安装它:
$ pip install nox
运行一切,包括测试和文档构建
$ nox
# Or to run a specific stage:
$ nox -s <stage name>, eg
$ nox -s tests
问题
如果您遇到任何问题,请提交问题并附上详细说明。
项目详情
下载文件
下载适用于您平台的文件。如果您不确定要选择哪个,请了解有关安装包的更多信息。
源分布
nbnpy-0.5.0.tar.gz
(5.1 kB
查看哈希)
内置分布
nbnpy-0.5.0-py3-none-any.whl
(4.6 kB
查看哈希)