Camera cgi call doesn't work from Client tagchange script

I have a several cameras (PTZOptics) that I can control the Preset by execution a cgi call from the tagchange script. The script looks like this:

import urllib2
urllib2.urlopen
import time
print event.tagPath
print initialChange
print newValue
if newValue.value:

    res = urllib2.urlopen(url='http://xx.xx.xxx.126/cgi-bin/param.cgi?pan_tiltdrive_reset')
   
    time.sleep (20)
    res = urllib2.urlopen(url='http://xx.xx.xxx.126/cgi-bin/ptzctrl.cgi?ptzcmd&poscall&11')

and it works perfect.

then we got a new camera (Amcrest) and simply substituted the part in the ‘ ‘ with ‘xx.xx.xxx.138/cgi-bin/ptz.cgi?action=start&channel=0&code=GotoPreset&arg1=0&arg2=1&arg3=0’

which works beautiful when you simply put in the address bar of a browser. But in the script as a tagchange Client script does exactly nothing. I spend half a day with AI trying to come up with a way to get it to work and again nothing. Not sure what to do here. Anyone come across this?

Maybe a difference in HTTP versions or behavior in the face of redirects?

Use Wireshark to see the difference in HTTP calls between your browser and your client tag change script.