华为LAN/WAN LTE调制解调器API
项目描述
huawei-lte-api
华为LAN/WAN LTE调制解调器API,您可以使用此API简单地发送短信、获取您的网络使用情况、信号等信息
如果您在商业上使用此包,请考虑赞助,我的时间不是免费的:)您可以通过点击顶部按钮行中的“赞助”按钮来赞助我。谢谢。
测试于
3G/LTE路由器
- 华为B310s-22
- 华为B311-221
- 华为B315s-22
- 华为B525s-23a
- 华为B525s-65a
- 华为B715s-23c
- 华为B528s
- 华为B535-232
- 华为B628-265
- 华为B612-233
- 华为B818-263
- 华为E5180s-22
- 华为E5186s-22a
- 华为E5576-320
- 华为E5577Cs-321
- 华为E8231
- 华为E5573s-320
- 赛亚-link B535-333
3G/LTE USB外置设备
(设备必须支持网络模式即“HiLink”版本,不支持串行模式)
- 华为E3131
- 华为E8372h-608
- 华为E3372
- 华为E3531
- 华为E5530As-2
5G路由器
- 华为5G CPE Pro 2 (H122-373)
- 华为5G CPE Pro (H112-372)
(可能也适用于其他华为LTE设备)
不适用于
LTE路由器
- 华为B2368-22 (不兼容固件,需要测试设备!)
- 华为B593s-22 (不兼容固件,需要测试设备!)
安装
PIP (一些发行版的pip3)
$ pip install huawei-lte-api
仓库
您还可以使用我维护的以下仓库
Debian 及其衍生版本
运行以下命令添加仓库
$ wget -O- https://repository.salamek.cz/deb/salamek.gpg | sudo tee /usr/share/keyrings/salamek-archive-keyring.gpg
$ echo "deb [signed-by=/usr/share/keyrings/salamek-archive-keyring.gpg] https://repository.salamek.cz/deb/pub all main" | sudo tee /etc/apt/sources.list.d/salamek.cz.list
然后您可以安装包 python3-huawei-lte-api
$ apt update && apt install python3-huawei-lte-api
Archlinux
通过在文件 /etc/pacman.conf 的末尾添加以下内容来添加仓库
[salamek]
Server = https://repository.salamek.cz/arch/pub/any
SigLevel = Optional
然后运行以下命令进行安装
$ pacman -Sy python-huawei-lte-api
Gentoo
$ emerge dev-python/huawei-lte-api
使用方法
from huawei_lte_api.Client import Client
from huawei_lte_api.Connection import Connection
# with Connection('http://192.168.8.1/') as connection: For limited access, I have valid credentials no need for limited access
with Connection('http://admin:MY_SUPER_TRUPER_PASSWORD@192.168.8.1/') as connection:
client = Client(connection) # This just simplifies access to separate API groups, you can use device = Device(connection) if you want
print(client.device.signal()) # Can be accessed without authorization
print(client.device.information()) # Needs valid authorization, will throw exception if invalid credentials are passed in URL
# For more API calls just look on code in the huawei_lte_api/api folder, there is no separate DOC yet
结果字典
{'DeviceName': 'B310s-22', 'SerialNumber': 'MY_SERIAL_NUMBER', 'Imei': 'MY_IMEI', 'Imsi': 'MY_IMSI', 'Iccid': 'MY_ICCID', 'Msisdn': None, 'HardwareVersion': 'WL1B310FM03', 'SoftwareVersion': '21.311.06.03.55', 'WebUIVersion': '17.100.09.00.03', 'MacAddress1': 'EHM:MY:MAC', 'MacAddress2': None, 'ProductFamily': 'LTE', 'Classify': 'cpe', 'supportmode': None, 'workmode': 'LTE'}
代码示例
监控
- 监控流量和信号 https://github.com/littlejo/huawei-lte-examples
- 设置频段,显示华为移动宽带 B525s-23a 的信号电平和带宽。 https://github.com/octave21/huawei-lte
- 监控互联网连接并在无法访问互联网时重新启动路由器的应用程序 https://github.com/Salamek/netkeeper
- 具有漂亮 TUI 界面的监控应用程序(类似于 htop) https://github.com/pdo-smith/5gtop
短信
端口到其他语言
- TypeScript/JavaScript https://github.com/Salamek/huawei-lte-api-ts
- PHP https://github.com/icetee/huawei-lte-api-php
捐赠
- 250 CZK (9,79 EUR) 用于 B535-232 基金,感谢 @larsvinc!
- 371,69 CZK (14,32 EUR) 由 Oleg Jusaew 捐赠
项目详情
关闭
huawei-lte-api-1.9.3.tar.gz 的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | b9ec1b8a9c546baa031f16350b2aeb345ea47e211052e9c0a521769936b53ecb |
|
MD5 | d996b4ececb5691bc2c6c63b6a2011b1 |
|
BLAKE2b-256 | d222dcc72c8f3164bee82425b5f366fdaa356cb770a30000ae9423562045d14d |