{"id":17172563,"url":"https://github.com/pablo/huawei-modem-python-api-client","last_synced_at":"2025-08-20T16:31:20.819Z","repository":{"id":30253015,"uuid":"124397463","full_name":"pablo/huawei-modem-python-api-client","owner":"pablo","description":"Modem USB Huawei HTTP API Python client","archived":false,"fork":false,"pushed_at":"2022-10-29T06:57:27.000Z","size":83,"stargazers_count":120,"open_issues_count":13,"forks_count":51,"subscribers_count":12,"default_branch":"master","last_synced_at":"2024-12-10T02:20:27.094Z","etag":null,"topics":["hacktoberfest"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pablo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-03-08T13:44:11.000Z","updated_at":"2024-10-10T17:23:27.000Z","dependencies_parsed_at":"2023-01-14T16:37:37.948Z","dependency_job_id":null,"html_url":"https://github.com/pablo/huawei-modem-python-api-client","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pablo%2Fhuawei-modem-python-api-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pablo%2Fhuawei-modem-python-api-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pablo%2Fhuawei-modem-python-api-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pablo%2Fhuawei-modem-python-api-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pablo","download_url":"https://codeload.github.com/pablo/huawei-modem-python-api-client/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":230438185,"owners_count":18225870,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["hacktoberfest"],"created_at":"2024-10-14T23:37:17.634Z","updated_at":"2024-12-19T13:07:14.472Z","avatar_url":"https://github.com/pablo.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"[![Build Status](https://github.com/dopstar/huawei-modem-python-api-client/workflows/build/badge.svg?branch=master)](https://github.com/dopstar/huawei-modem-python-api-client/actions?query=workflow%3Abuild)\n[![codecov](https://codecov.io/gh/dopstar/huawei-modem-python-api-client/branch/master/graph/badge.svg)](https://codecov.io/gh/dopstar/huawei-modem-python-api-client)\n[![Python Version](https://img.shields.io/pypi/pyversions/huawei-modem-api-client.svg)](https://pypi.python.org/pypi/huawei-modem-api-client)\n[![PyPI Status](https://img.shields.io/pypi/v/huawei-modem-api-client.svg)](https://pypi.python.org/pypi/huawei-modem-api-client)\n[![PyPI Downloads](https://img.shields.io/pypi/dm/huawei-modem-api-client.svg)](https://pypi.python.org/pypi/huawei-modem-api-client)\n[![Licence](https://img.shields.io/github/license/pablo/huawei-modem-python-api-client.svg)](https://raw.githubusercontent.com/pablo/huawei-modem-python-api-client/master/LICENSE.md)\n\n# Python HTTP API client for Huawei Modems\n\nThis is a python library to interact with a Huawei modem over HTTP API.\n\nThe library has been tested on these devices:\n* E5180\n* E8372\n* B315\n* B529s-23a\n* H122-373 (HUAWEI 5G CPE Pro 2 locoked to the UK Network Three)\n\nPlease let me know if you tested it successfully with other modems as well.\n\n## Currently Supported\n\n* webserver\n   * get_session_token_info: gets a session token to use\n* user\n   * login: creates a new session on the HTTP API\n   * logout: deletes current session on the HTTP API\n* sms\n   * get_sms: get information from boxes: inbox, outbox\n   * send_sms: sends an SMS through device's modem\n   * delete_sms: deletes an sms from one of their boxes\n   * sms_count: get the sms count on each box\n   * sms_set_read: set the sms status to read\n* ussd\n   * status: get status of ussd. This will tell you if there are ussd messages available to read\n   * send: sends a ussd message\n   * get: retrieves a ussd message\n* wlan:\n    * get_connected_hosts: gets a list of connected devices\n    * block_host: blocks the device from network\n    * unblock_host: unblock device on network\n    * get_blocked_hosts: gets a list of blocked devices\n    * is_host_blocked: checks if device is blocked\n    * switch_wlan_24ghz: allows to switch on or off the wlan 2.4Ghz module of the router\n    * switch_wlan_5ghz: allows to switch on or off the wlan 5Ghz module of the router\n* dialup:\n    * connect_mobile: enables mobile (ie LTE / 4G / 3G / etc) network\n    * disconnect_mobile: disables mobile network\n    * get_mobile_status: checks the mobile connection status\n* device:\n    * reboot: reboots the modem\n\n### Prerequisites\n\n[`requests`](https://github.com/requests/requests) library (and its dependencies) is required.\n[`six`](https://pypi.org/project/six/) library (and its dependencies for Python 2 and 3 compatibility)\n[`typing`](https://docs.python.org/3/library/typing.html) library (support for type hints)\n\nThis is `requirements.txt` content:\n\n```\nrequests\u003e=2.25.1\nsix\u003e=1.15.0\ntyping\u003e=3.7.4.3\n```\n\n### Installing\n\n```bash\npip install huawei-modem-api-client\n```\n\n### Example\n```python\nimport huaweisms.api.user\nimport huaweisms.api.wlan\nimport huaweisms.api.sms\n\nctx = huaweisms.api.user.quick_login(\"myusername\", \"mypassword\")\nprint(ctx)\n# output: \u003cApiCtx modem_host=192.168.8.1\u003e\n\n# sending sms\nhuaweisms.api.sms.send_sms(\n    ctx,\n    'phone-number',\n    'this is the sms message'\n)\n\n# connected devices\ndevice_list = huaweisms.api.wlan.get_connected_hosts(ctx)\n\n```\n\nNote: The default modem host is assumed to be `192.168.8.1`. If that is not the case for you, you can specify your modem ip as follows:\n\n```python\nimport huaweisms.api.user\nctx = huaweisms.api.user.quick_login(\"myusername\", \"mypassword\", modem_host='10.11.12.13')\nprint(ctx)\n\n#output: \u003cApiCtx modem_host=10.11.12.13\u003e\n```\n\n### HTTPS Examples\n\nWhen the router uses HTTPS instead of HTTP, you can pass the `uri_scheme` when creating the context instance which\nbecomes used on subsequent api calls that use the same context.\n```python\nimport huaweisms.api.user\nctx = huaweisms.api.user.quick_login(\n  'username',\n  'password',\n  modem_host='192.168.12.13',\n  uri_scheme='https'\n)\n```\n\nIf the router that uses HTTPS uses self-signed certificates, there will be SSL errors. You can ignore certificate \nvalidation/verification as follows:\n```python\nimport huaweisms.api.user\nctx = huaweisms.api.user.quick_login(\n  'username',\n  'password',\n  modem_host='192.168.12.13',\n  uri_scheme='https',\n  verify=False\n)\n```\n\n## Built With\n\n* [requests](https://github.com/requests/requests) - Python HTTP Requests for Humans™\n\n## Contributing\n\nSend me a PM if you want to contribute. \n\n## Authors\n\n* **Pablo Santa Cruz** - *Owner* - [pablo](https://github.com/pablo)\n* **Mka Madlavana** - *Collaborator* - [dopstar](https://github.com/dopstar)\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpablo%2Fhuawei-modem-python-api-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpablo%2Fhuawei-modem-python-api-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpablo%2Fhuawei-modem-python-api-client/lists"}