Vause Dio
Vause Dio

Reputation: 11

Python and Huawei Wingle - getting error when I send USSD code (using huawei-modem-python-api-client library)

I have been working on a project using python and Huawei wingle E8372 (usb wingle) to send USSD code, fetch response which is returned by server and then also show the status of ussd (if required).

I am using huawei-modem-python-api-client library for my project I'm at initial stage yet I finished many things in coding like making a connection, sending sms and reboot etc.

But when I started working with USSD code, I started getting error, might be there is an error in the code so May I ask you whats the error in my code?

Here's the code:

import huaweisms.api.user
import huaweisms.api.wlan
import huaweisms.api.sms
import huaweisms.api.ussd
import huaweisms.api.device

ctx = huaweisms.api.user.quick_login("admin", "admin123")
print(ctx)
#Till this line it works Great



#This ussd code is to check balance: *101#
#This code doesn't work, no matter what I changed:
r = huaweisms.api.ussd.send(ctx, "*101#")
print(r)

print("\n........................\n")

r = huaweisms.api.ussd.get(ctx)
print(r)


#connected devices
device_list = huaweisms.api.wlan.get_connected_hosts(ctx)

When I execute this code it gives the following error:

c:\python_codes>py ussd.py
<ApiCtx modem_host=192.168.8.1>
{'type': 'error', 'error': {'code': '1001', 'message': ''}}

........................

{'type': 'error', 'error': {'code': '100002', 'message': ''}}

Upvotes: 1

Views: 1400

Answers (2)

lam vu Nguyen
lam vu Nguyen

Reputation: 641

please try other function, example huaweisms.api.sms.get_sms() or huaweisms.api.sms.send_sms()

some day ago I faced to 108006 error because of wrong username (default is admin), 2 functions above worked for me with true username

update: in current version, module huaweisms.api has no attribute ussd; there are get_sms(), send_sms(), delete_sms(), sms_count(), sms_set_read()

Upvotes: 1

user14302374
user14302374

Reputation: 11

I got the same message and seems as far I was able to check this code means something like "not supported by firmware or incorrect API path".

Probably should be upgraded modem firmware.

Check also this Hilink Go package and resources on it for more details

Upvotes: 1

Related Questions