Skip to content

implementing AXIS CGI commands using Python Requests with username+password authentication #37

Closed Answered by mattias-kindborg-at-work
thilleary asked this question in VAPIX
Discussion options

You must be logged in to vote

To start off, I'm not using urllib3 but instead requests. I'm hoping that urllib3 wasn't a hard requirement.

Create the following files in a directory.

requirements.txt

requests

list-camera-parameters.py

import requests
import sys

if len(sys.argv) != 4:
    print("Usage: list-camera-parameters.py <ip> <username> <password>")
    sys.exit(1)

ip = sys.argv[1]
username = sys.argv[2]
password = sys.argv[3]

auth = requests.auth.HTTPDigestAuth(username, password)
r = requests.get("http://{}/axis-cgi/admin/param.cgi?action=list&group".format(ip), auth=auth)

print(r.status_code)
print(r.text)

Then create and activate a new virtual environment:

python3 -m venv env
source env/bin/activate

Proc…

Replies: 6 comments 4 replies

Comment options

You must be logged in to vote
2 replies
@thilleary
Comment options

@mattias-kindborg-at-work
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by mattias-kindborg-at-work
Comment options

You must be logged in to vote
2 replies
@thilleary
Comment options

@mattias-kindborg-at-work
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
VAPIX
Labels
None yet
3 participants