AdWords Python API: Passing Proxy Username and Password

215 views
Skip to first unread message

F D

unread,
Mar 31, 2016, 9:06:24 AM3/31/16
to AdWords API Forum
Hi there,

I'm running into a bit of an issue as I'm behind a corp firewall which requires traffic to go through a proxy and also needs authentication.

I'm just loading a credentials file using the method
AdWordsClient.LoadFromStorage("/path/to/myfile")
which will throw the following error:

HTTPError: (407, 'Proxy Authentication Required')

I believe the client will call the OAuth library and try and refresh the necessary tokens., but looking at the following code shows that proxy_user and proxy_pass are never sent to httplib2.ProxyInfo



I was thinking of opening an issue but figure I should ask as maybe I'm missing something in terms of a work around.

Thanks in advance
F D.

Yin Niu

unread,
Mar 31, 2016, 9:58:20 AM3/31/16
to AdWords API Forum
Hello, 

The python library owner is currently working on an enhancement for proxy support that should fix this problem. For now, one hack might be to include the username and password in the host argument alone with the url/ip. It's not intended to be used that way as it was originally designed, though. 

Thanks,
Yin, AdWords API Team. 

F D

unread,
Mar 31, 2016, 10:53:07 AM3/31/16
to AdWords API Forum
Thanks for the response
I did try doing that. I have something like this in my googleads.yaml:

# Proxy configurations (optional)
proxy_info
:
  host
: username:password@myproxy.com
  port
: 1234

Throws an error in httplib2: 

httplib2.ServerNotFoundError: Unable to find the server at accounts.google.com

I believe httplib2 has specific settings for the proxy username and password which never get set in line 118 in the above link.

Any idea on when the fix might be introduced?


Thanks again!

Nadine Sundquist (AdWords API Team)

unread,
Mar 31, 2016, 12:19:34 PM3/31/16
to AdWords API Forum
Greetings!

At this point, I think you'll have to work directly with our Python client library owner to get this figured out, since this forum is meant for specifically API issues. The best way to do that is to file an issue under the Ads API Python GitHub issue tracker. He's really great at working one on one with people to get client library nuances figured out.

Thanks,
Nadine, AdWords API Team
Reply all
Reply to author
Forward
0 new messages