in labs/CalcAPI/remotetest.py [0:0]
def _dodotprod(self):
print(self._pyarr1[:5])
print(self._pyarr2[:5])
apidata = { "arr1":self._pyarr1,"arr2":self._pyarr2 }
r_header = {'Content-Type':'application/json'}
try:
req = requests.post('http://{}/dotprod'.format(REMOTE_IP), data=json.dumps(apidata), headers=r_header)
r_json = req.json()
fval = float(r_json["result"])
print("full remote:{}".format(fval))
except requests.ConnectionError:
print("full remote: connection FAILED!")
except ValueError:
print("full remote: JSON error FAILED!")
except:
print("full remote: error FAILED!")
self._pyarr1 = None
self._pyarr2 = None