googlebot: Thanks for your pull request.  It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

:memo: **Please visit <https://cla.developers.google.com/> to sign.**

Once you've signed, please reply here (e.g. `I signed it!`) and we'll verify.  Thanks.

---

- If you've already signed a CLA, it's possible we don't have your GitHub username or you're using a different email address.  Check [your existing CLA data](https://cla.developers.google.com/clas) and verify that your [email is set on your git commits](https://help.github.com/articles/setting-your-email-in-git/).
- If you signed the CLA as a corporation, please let us know the company's name.

<!-- need_sender_cla -->
xmedeko: I signed it!
googlebot: CLAs look good, thanks!

<!-- ok -->
coveralls: 
[![Coverage Status](https://coveralls.io/builds/11551076/badge)](https://coveralls.io/builds/11551076)

Coverage increased (+0.08%) to 52.904% when pulling **ab4448b6168073bc916a0c0464c85dc42af72521 on xmedeko:master** into **128d229807577809a437cd20161c3c496080991f on GoogleCloudPlatform:master**.

xmedeko: @jonparrott thanks for the review.

For the `proxy_info` see the Http doc:
```
 `proxy_info` may be:
          - a callable that takes the http scheme ('http' or 'https') and
            returns a ProxyInfo instance per request.
          - a ProxyInfo instance (static proxy config).
          - None (proxy disabled).
```
I just add that the callable returns `None` when no proxy is configured (the usual case).
To be perfect compatible with the `httplib2` the `_default_make_pool` should check if it's callable or not. But I assume this is a temporary transition library so we do not be perfect - a user may simply do a lambda expression.

In regards of doc, I would rather step back and remove the doc if you do not like it. It may be added in the separate commit. Because:
- I do not use Google docstring style -> mistakes.
- I am not a native speaker ->mistakes.
- IMO doc for the private `_default_make_pool` is not necessary, better to make doc for the public `Http.__init__` - but do we have to copy the super class doc? I do not know. 
- It's not documented know and this commit is not commit to fix the doc.


cwt: @xmedeko It was my false that I didn't test all possible cases of the variable `proxy_info`. There should be a scenario that the proxy environment already set, but we want to disable it manually in the code (`proxy_info=None`).
jonparrott: It seems to me that we want is:

```python
import collections

if isinstance(proxy_info, collections.Callable):
    proxy_info = proxy_info()

if proxy_info:
    ...
```

> In regards of doc, I would rather step back and remove the doc if you do not like it. It may be added in the separate commit.

I'm happy to write the docstring for you. :) I just need to understand the change first.
xmedeko: Great! Now the `proxy_info` param is backward compatible, so the doc is not necessary :-)
I've amended the commit and added a simple unit test, too.
coveralls: 
[![Coverage Status](https://coveralls.io/builds/11578406/badge)](https://coveralls.io/builds/11578406)

Coverage increased (+1.02%) to 53.839% when pulling **0933c31513effb84194f7ff56cd923bac38189ce on xmedeko:master** into **128d229807577809a437cd20161c3c496080991f on GoogleCloudPlatform:master**.

diff --git a/httplib2shim/__init__.py b/httplib2shim/__init__.py
index bdc9a8c..42b3aa6 100644
--- a/httplib2shim/__init__.py
+++ b/httplib2shim/__init__.py
@@ -20,6 +20,7 @@
 # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 # SOFTWARE.
 
+import collections
 import errno
 import socket
 import ssl
@@ -41,6 +42,8 @@ def _default_make_pool(http, proxy_info):
 
     cert_reqs = 'CERT_REQUIRED' if http.ca_certs and not ssl_disabled else None
 
+    if isinstance(proxy_info, collections.Callable):
+        proxy_info = proxy_info()
     if proxy_info:
         if proxy_info.proxy_user and proxy_info.proxy_pass:
             proxy_url = 'http://{}:{}@{}:{}/'.format(
@@ -111,7 +114,7 @@ class Http(httplib2.Http):
             disable_ssl_certificate_validation=disable_ssl)
 
         if not pool:
-            pool = self._make_pool(proxy_info=proxy_info())
+            pool = self._make_pool(proxy_info=proxy_info)
 
         self.pool = pool
 

proxy_info cannot be None for the ver. 0.0.2
After upgrade to ver. 0.0.2 I cannot call `httplib2shim.Http(proxy_info=None)`, it results in:
```
 File "/usr/local/lib/python3.5/dist-packages/httplib2shim/__init__.py", line 114, in __init__
    pool = self._make_pool(proxy_info=proxy_info())
TypeError: 'NoneType' object is not callable
```
Also, the `proxy_info` for the httplib2 may not be callable. While it's easy to make a lambda to change variable to callable, it's nice to allow `None` as proxy_info (and backward compatible, too.)
diff --git a/httplib2shim/test/httplib2_test.py b/httplib2shim/test/httplib2_test.py
index 5bfbd02..abb234f 100644
--- a/httplib2shim/test/httplib2_test.py
+++ b/httplib2shim/test/httplib2_test.py
@@ -39,6 +39,7 @@ import httplib2
 import httplib2shim
 import six
 from six.moves.urllib import parse as urllib_parse
+import urllib3
 
 
 __author__ = "Joe Gregorio (joe@bitworking.org)"
@@ -1880,3 +1881,19 @@ class TestProxyInfo(unittest.TestCase):
         os.environ.clear()
         pi = httplib2.proxy_info_from_environment()
         self.assertEqual(pi, None)
+
+
+class HttpShimProxyPoolTest(unittest.TestCase):
+
+    def test_none(self):
+        http = httplib2.Http(proxy_info=None)
+        self.assertIsInstance(http.pool, urllib3.PoolManager)
+        http = httplib2.Http(proxy_info=lambda: None)
+        self.assertIsInstance(http.pool, urllib3.PoolManager)
+
+    def test_instance_and_callable(self):
+        proxy_info = httplib2.proxy_info_from_url('http://myproxy.example.com')
+        http = httplib2.Http(proxy_info=proxy_info)
+        self.assertIsInstance(http.pool, urllib3.ProxyManager)
+        http = httplib2.Http(proxy_info=lambda: proxy_info)
+        self.assertIsInstance(http.pool, urllib3.ProxyManager)

pip install -e .[dev]
parse_log_pytest
requirements.txt
pytest
3.6
requirements-dev.txt
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
attrs==22.2.0
certifi==2021.5.30
cffi==1.15.1
coverage==6.2
cryptography==40.0.2
httplib2==0.22.0
-e git+https://github.com/GoogleCloudPlatform/httplib2shim.git@128d229807577809a437cd20161c3c496080991f#egg=httplib2shim
idna==3.10
importlib-metadata==4.8.3
iniconfig==1.1.1
nose==1.3.7
packaging==21.3
pluggy==1.0.0
py==1.11.0
pycparser==2.21
pyOpenSSL==23.2.0
pyparsing==3.1.4
pytest==7.0.1
six==1.17.0
tomli==1.2.3
typing_extensions==4.1.1
urllib3==1.26.20
urllib3-secure-extra==0.1.0
zipp==3.6.0

name: httplib2shim
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - ca-certificates=2025.2.25=h06a4308_0
  - certifi=2021.5.30=py36h06a4308_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.3=he6710b0_2
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - ncurses=6.4=h6a678d5_0
  - openssl=1.1.1w=h7f8727e_0
  - pip=21.2.2=py36h06a4308_0
  - python=3.6.13=h12debd9_1
  - readline=8.2=h5eee18b_0
  - setuptools=58.0.4=py36h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - wheel=0.37.1=pyhd3eb1b0_0
  - xz=5.6.4=h5eee18b_1
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - attrs==22.2.0
      - cffi==1.15.1
      - coverage==6.2
      - cryptography==40.0.2
      - httplib2==0.22.0
      - idna==3.10
      - importlib-metadata==4.8.3
      - iniconfig==1.1.1
      - nose==1.3.7
      - packaging==21.3
      - pluggy==1.0.0
      - py==1.11.0
      - pycparser==2.21
      - pyopenssl==23.2.0
      - pyparsing==3.1.4
      - pytest==7.0.1
      - six==1.17.0
      - tomli==1.2.3
      - typing-extensions==4.1.1
      - urllib3==1.26.20
      - urllib3-secure-extra==0.1.0
      - zipp==3.6.0
prefix: /opt/conda/envs/httplib2shim

httplib2shim/test/httplib2_test.py::HttpShimProxyPoolTest::test_instance_and_callable httplib2shim/test/httplib2_test.py::HttpShimProxyPoolTest::test_none
httplib2shim/test/httplib2_test.py::UrlSafenameTest::test httplib2shim/test/httplib2_test.py::HttpPrivateTest::testParseWWWAuthenticate httplib2shim/test/httplib2_test.py::HttpPrivateTest::testParseWWWAuthenticateBasic httplib2shim/test/httplib2_test.py::HttpPrivateTest::testParseWWWAuthenticateBasic2 httplib2shim/test/httplib2_test.py::HttpPrivateTest::testParseWWWAuthenticateBasic3 httplib2shim/test/httplib2_test.py::HttpPrivateTest::testParseWWWAuthenticateDigest httplib2shim/test/httplib2_test.py::HttpPrivateTest::testParseWWWAuthenticateEmpty httplib2shim/test/httplib2_test.py::HttpPrivateTest::testParseWWWAuthenticateMalformed httplib2shim/test/httplib2_test.py::HttpPrivateTest::testParseWWWAuthenticateMoreQuoteCombos httplib2shim/test/httplib2_test.py::HttpPrivateTest::testParseWWWAuthenticateMultiple httplib2shim/test/httplib2_test.py::HttpPrivateTest::testParseWWWAuthenticateMultiple2 httplib2shim/test/httplib2_test.py::HttpPrivateTest::testParseWWWAuthenticateMultiple3 httplib2shim/test/httplib2_test.py::HttpPrivateTest::testParseWWWAuthenticateMultiple4 httplib2shim/test/httplib2_test.py::HttpPrivateTest::testParseWWWAuthenticateStrict httplib2shim/test/httplib2_test.py::HttpPrivateTest::testWsseAlgorithm
httplib2shim/test/httplib2_test.py::CredentialsTest::test httplib2shim/test/httplib2_test.py::ParserTest::testFromStd66 httplib2shim/test/httplib2_test.py::UrlNormTest::test httplib2shim/test/httplib2_test.py::HttpTest::testGet301ViaHttps httplib2shim/test/httplib2_test.py::HttpTest::testGetConnectionRefused httplib2shim/test/httplib2_test.py::HttpTest::testGetUnknownServer httplib2shim/test/httplib2_test.py::HttpTest::testGetViaHttps httplib2shim/test/httplib2_test.py::HttpTest::testGetViaHttpsKeyCert httplib2shim/test/httplib2_test.py::HttpTest::testGetViaHttpsSpecViolationOnLocation httplib2shim/test/httplib2_test.py::HttpTest::testHeadRead httplib2shim/test/httplib2_test.py::HttpTest::testIPv6NoSSL httplib2shim/test/httplib2_test.py::HttpTest::testIPv6SSL httplib2shim/test/httplib2_test.py::HttpTest::testPickleHttp httplib2shim/test/httplib2_test.py::HttpTest::testSniHostnameValidation httplib2shim/test/httplib2_test.py::HttpTest::testSslCertValidation httplib2shim/test/httplib2_test.py::HttpPrivateTest::testConvertByteStr httplib2shim/test/httplib2_test.py::HttpPrivateTest::testDigestObject httplib2shim/test/httplib2_test.py::HttpPrivateTest::testDigestObjectAuthInfo httplib2shim/test/httplib2_test.py::HttpPrivateTest::testDigestObjectStale httplib2shim/test/httplib2_test.py::HttpPrivateTest::testDigestObjectWithOpaque httplib2shim/test/httplib2_test.py::HttpPrivateTest::testEnd2End httplib2shim/test/httplib2_test.py::HttpPrivateTest::testExpirationMaxAge0 httplib2shim/test/httplib2_test.py::HttpPrivateTest::testExpirationModelDateAndExpires httplib2shim/test/httplib2_test.py::HttpPrivateTest::testExpirationModelDateAndExpiresMinFresh1 httplib2shim/test/httplib2_test.py::HttpPrivateTest::testExpirationModelDateAndExpiresMinFresh2 httplib2shim/test/httplib2_test.py::HttpPrivateTest::testExpirationModelDateOnly httplib2shim/test/httplib2_test.py::HttpPrivateTest::testExpirationModelFresh httplib2shim/test/httplib2_test.py::HttpPrivateTest::testExpirationModelMaxAgeBoth httplib2shim/test/httplib2_test.py::HttpPrivateTest::testExpirationModelNoCacheResponse httplib2shim/test/httplib2_test.py::HttpPrivateTest::testExpirationModelOnlyIfCached httplib2shim/test/httplib2_test.py::HttpPrivateTest::testExpirationModelStaleRequestMustReval httplib2shim/test/httplib2_test.py::HttpPrivateTest::testExpirationModelStaleResponseMustReval httplib2shim/test/httplib2_test.py::HttpPrivateTest::testExpirationModelTransparent httplib2shim/test/httplib2_test.py::HttpPrivateTest::testExpiresZero httplib2shim/test/httplib2_test.py::HttpPrivateTest::testMaxAgeNonNumeric httplib2shim/test/httplib2_test.py::HttpPrivateTest::testNormalizeHeaders httplib2shim/test/httplib2_test.py::HttpPrivateTest::testParseCacheControl httplib2shim/test/httplib2_test.py::TestProxyInfo::test_from_env httplib2shim/test/httplib2_test.py::TestProxyInfo::test_from_env_no_proxy httplib2shim/test/httplib2_test.py::TestProxyInfo::test_from_env_none httplib2shim/test/httplib2_test.py::TestProxyInfo::test_from_url httplib2shim/test/httplib2_test.py::TestProxyInfo::test_from_url_ident
httplib2shim/__init__.py
httplib2shim/__init__.py