Skip to content

Instantly share code, notes, and snippets.



Created Jan 9, 2018
What would you like to do?
Python 3 (no dependency) authenticated request to NetworkOptix (demo)
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
import base64
import urllib.request
url_request = urllib.request.Request('')
url_request.add_header('Authorization', f'Basic {base64.b64encode(b"demo:nxwitness").decode("utf-8")}')
response = urllib.request.urlopen(url_request)
data = or 'utf-8')
data = json.loads(data)
from pprint import pprint
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment