Comments (5)
Hello,
I strongly suspect the core issue here is that you're defining the proxy outside of the library. As currently implemented, we use ProxyConfig to pass the proxy details along to Zeep. This can be configured in googleads.yaml, or passed along as an argument for AdManagerClient if you prefer to set it up manually.
Regards,
Mark
from googleads-python-lib.
Hi Mark,
thanks for the quick reply.
I doubt that this is the case (maybe my hint about requests was misleading, because I do not use this in the current Google Ads project).
I do specify the proxy in the googleads.yaml like so:
proxy_config:
'http': 'http://[DOMAIN]%5C[USER]:[PWD]@[HOST]:8080'
This config is then used
from googleads import ad_manager
ad_manager_client = ad_manager.AdManagerClient.LoadFromStorage("googleads.yaml")
activity_service = ad_manager_client.GetService('ActivityService', version='v202402')
When I try to get the ActivityService for example, I get the 407.
from googleads-python-lib.
Hello,
Thanks for clarifying, I had in fact misinterpreted that original post, sorry about that!
So, I'll be upfront about itβit would be quite difficult for me to troubleshoot your specific proxy issue, but I can say that the fact you received an HTTP 407 response strongly suggests that the library passed along your proxy configuration to Zeep, which then made the request, and did at least communicate with your proxy so that it could return the authentication error. I'd like to at least provide some explanation on why this doesn't appear to be an issue with this library though, so read on if that interests you.
Looking at the underlying implementation, LoadFromStorage
eventually extracts a ProxyConfig based on your proxy_config
found in googleads.yaml. When you call GetService
, that ProxyConfig
is then passed to GetServiceClassForLibrary, which uses ZeepServiceProxy
to initialize a transport with the ProxyConfig
, which is used by Zeep's Client to handle communication. I can confirm that the proxy configuration is passed to Zeep and should be applied to its requests, so as far as this library is concerned it appears to be working as intended.
For some additional context, the transport created above is a _ZeepProxyTransport, which applies the proxies to the Session used by the Zeep Client
to make requests. As an example, for the GetService
call, Zeep eventually calls the transport's _load_remote_data, where the following is used to retrieve the WSDL:
response = self.session.get(url, timeout=self.load_timeout)
Once again, I can confirm that the proxy configuration is applied to the session used to make the call, so it appears to be working as intended.
from googleads-python-lib.
Hi Marc,
thank you for this extensive explanation. With that I was able to resolve the issue.
Figuring out that request does in fact handle Zeep's transport, I worked up a minimal example for a proxied session. As it turned out, request was ignoring the explicitly configured proxy in favor of a environment varible that was still set and I didn't know about. Removing that env var (either by session.trust_env=False or manually) the proxy config was then recognized correctly.
Thanks again and best regards
from googleads-python-lib.
Great, happy to hear you were able to figure it out!
from googleads-python-lib.
Related Issues (20)
- Error: No module named 'google.api_core HOT 1
- How to properly use the API to generate a report? HOT 2
- Generating a report and getting different values HOT 2
- How to filter by Child Publisher Network Code?
- How to export the API generated report in the UI? HOT 11
- How to get all mobile applications using the api?
- Is there a way to get all apps that are on the report and not on the inventory? HOT 2
- How to filter a report using an app name with a backtick?
- Enable constructing GoogleServiceAccountClient with Credentials.from_service_account_info method HOT 1
- Google Group for the Ads API no longer available HOT 1
- Google Ad Manager API - googleads library compatibility HOT 1
- When is googleads 36.0.0 python package sunset date? HOT 4
- GoogleRefreshTokenClient could not authenticate to create AdManager Client - 401 Unauthorized HOT 1
- KeyError occured when trying to access the 'report_service.runReportJob()' function HOT 1
- Method to authenticate via environment variables HOT 1
- Google Ad Manager API Custom Dimensions Using saved_report_query HOT 1
- How to check if the service account is connected/invited to the someone else Google Ads? HOT 1
- Help Needed: Error while Retrieving First Party Audience Segmentations in GoogleAds Python Library [ServerError.SERVER_ERROR @ ]' HOT 1
- urlopen error [SSL: CERTIFICATE_VERIFY_FAILED]: unable to get local issuer certificate HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from googleads-python-lib.