passmanager.add_password(None, baseurl, username, password)
auth_handler = urllib.request.HTTPBasicAuthHandler(passmanager)
opener = urllib.request.build_opener(auth_handler, NoOpHandler())
Как реализовать curl -u в Python?