@dennix if it's not a huge pain on the device, that'll probably turn out to be much easier on the python side. requests is your friend here.
http://docs.python-requests.org/en/master/user/quickstart/