How to specify an authenticated proxy for a python http connection?

What’s the best way to specify a proxy with username and password for an http connection in python?


Use this:

import requests

proxies = {"http":"http://username:password@proxy_ip:proxy_port"}

r = requests.get("", proxies=proxies)


I think it’s much simpler than using urllib. I don’t understand why people love using urllib so much.