urllib.request error while trying to set up an SMS gateway using a Huawei E3531 3G dongle

95 views Asked by At

Here's my code:

import urllib.request

url = "http://192.168.8.1/api/dialup/dial"

data = "<request><Action>1</Action></request>"
data = data.encode("utf-8")

headers = {"Content-Type": "application/xml"}

request = urllib.request.Request(url, data = data, headers = headers)
response = urllib.request.urlopen(request)

print(response.getcode())
print(response.read())

The output is:

200

b'< ?xml version="1.0" encoding="UTF-8"? >\r\n< error >\r\n< code >125002< /code >\r\n< message >< /message >\r\n< /error >\r\n'

(spaces added)

I can connect to the dongle through a web browser and connect and send messages manually. Why am I getting this error, and what does it mean?

0

There are 0 answers