Google AdWords API报错:AttributeError: 'HTTPSConnectionWithTimeout'无proxy_info属性
Hey there, let’s work through this error you’re hitting with the Google AdWords Python library. This issue almost always boils down to version incompatibility between the legacy googleads-python-lib and the httplib2 library you have installed. Here’s how to fix it step by step:
1. Downgrade httplib2 to a compatible version
The older googleads-python-lib relies on specific methods in httplib2 that were removed or refactored in versions after 0.20.0. To resolve the missing proxy_info attribute error:
- Open your terminal or command prompt
- Run this command to install a compatible version of httplib2:
pip install httplib2==0.19.0 - After installation, try running your AdWords API call again. This should fix the attribute mismatch, since the 0.19.0 version still includes the
proxy_infoproperty the legacy library expects.
2. Double-check your googleads.yaml proxy configuration (if applicable)
If you’ve set up a proxy in your googleads.yaml file, confirm the format is correct. A valid proxy entry should look like this:
proxy: http://user:password@proxy.example.com:8080
While versioning is the main culprit here, an incorrectly formatted proxy can sometimes trigger related connection errors, so it’s worth verifying this is set properly.
3. Consider upgrading to the official Google Ads API library (optional)
Note that googleads-python-lib is a legacy tool for the older AdWords API. Google now recommends using the newer google-ads library for the Google Ads API (which replaces the AdWords API). If you’re starting a new project or can migrate, switching to this library will avoid these legacy version compatibility issues entirely. Install it with:
pip install google-ads
Once you try the first step (downgrading httplib2), your API calls should start working as expected without the proxy_info attribute error.
内容的提问来源于stack exchange,提问作者wendybear

