I'm trying to control a PTZ camera via its built-in web server, which requires authentication. I have the URLs working in Safari (and Chrome), but the first URL I send via a browser requires a username and password. Subsequent URLs work without authentication.
I want to use Python within Indigo, to send a URL to the cam, so that I can make controls on my Indigo Video control page that will do things like turn on/off the IR lights, or move the cam to preset positions, or zoom, etc. Something like this:
# where xxx.xxx.xxx.xxx is my cam's local IP address
- Code: Select all
import requests
requests.get('http://myUserName:myPassword@xxx.xxx.xxx.xxx/and-then-my-cams-specific-commands-and-parameters-etc')
That doesn't work. So I poked around and found some Python authentication stuff, like this:
- Code: Select all
import requests
from requests.auth import HTTPBasicAuth
requests.get('http://xxx.xxx.xxx.xxx/and-then-my-cams-specific-commands-and-parameters-etc', auth=HTTPBasicAuth('myUserName', 'myPassword'))
Which also doesn't work.
I've also tried using "curl" in Terminal, to get a command line string that I could then call from AppleScript or Python within Indigo, and I can't get that to authenticate, either.
Ideas?