跳转到主要内容

华为LAN/WAN LTE调制解调器API

项目描述

huawei-lte-api

华为LAN/WAN LTE调制解调器API,您可以使用此API简单地发送短信、获取您的网络使用情况、信号等信息

Tox tests

如果您在商业上使用此包,请考虑赞助,我的时间不是免费的:)您可以通过点击顶部按钮行中的“赞助”按钮来赞助我。谢谢。

测试于

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'}

代码示例

一些代码示例 示例/examples 文件夹中

监控

短信

端口到其他语言

捐赠

  • 250 CZK (9,79 EUR) 用于 B535-232 基金,感谢 @larsvinc!
  • 371,69 CZK (14,32 EUR) 由 Oleg Jusaew 捐赠

项目详情


下载文件

下载适合您平台的文件。如果您不确定选择哪个,请了解更多关于 安装包 的信息。

源分布

huawei-lte-api-1.9.3.tar.gz (36.2 kB 查看哈希值)

上传时间

由以下机构支持

AWS AWS 云计算和安全赞助商 Datadog Datadog 监控 Fastly Fastly CDN Google Google 下载分析 Microsoft Microsoft PSF 赞助商 Pingdom Pingdom 监控 Sentry Sentry 错误日志 StatusPage StatusPage 状态页面