Readd support for proxies from env vars

This is a regression when we upgraded to requests 1.x.
A proxy can be figured via the normal env vars used by
requests.

Part of this change included refactoring the endpoint classes
to remove some duplication.  I've also added unit tests for
these changes.