#!/usr/local/bin/python3 import urllib.request, urllib.parse import base64 usr = "aerobatic" pwd = "aerobatic" top_level_url = "https://auth-demo.aerobatic.io/protected-standard/" base64string = base64.encodestring(('%s:%s' % (usr, pwd)).encode("utf-8"))[:-1] headers = { "Authorization": "Basic %s" % base64string.decode("utf-8") } req = urllib.request.Request(top_level_url, headers=headers) with urllib.request.urlopen(req) as res: html = res.read().decode("utf-8") print(html)