Sending data from Raspberry to server

Hi,
I’ve a SIXFAB modem with a Hologram SIM. In my Raspberry I’m able to connect to internet with sudo pon. I’m non be able to send data with this code:
import subprocess
import requests

MyOut = subprocess.Popen([“sudo”, “pon”], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
stdout, stderr = MyOut.communicate()
print(stdout)
print(stderr)
userdata = {“sistema”:“acceso”}
resp = requests.post(‘http://xxx.xxx.org/restapi.php’, params=userdata, timeout=10)

I’ve got this error:
requests.exceptions.ConnectionError: HTTPConnectionPool(host=‘socnetwork.altervista.org’, port=80): Max retries exceeded with url: /restapi.php?sistema=acceso (Caused by NewConnectionError(‘<urllib3.connection.HTTPConnection object at 0xb654c3f0>: Failed to establish a new connection: [Errno -2] Name or service not known’,))

Thanks a lot

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.