0

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?

Paul Brennan
  • 2,638
  • 4
  • 19
  • 26
Davies Dan
  • 11
  • 1
  • What happens if you open `http://192.168.8.1/api/dialup/dial` without data and the headers? What response does a browser get when you open `http://192.168.8.1/api/dialup/dial` in it? – zvone Jan 01 '21 at 21:43
  • I get a blank website with the text number 100001 in the top left corner. There's nothing else on the page. Does this number mean something? Thank you! – Davies Dan Jan 02 '21 at 18:05

0 Answers0