You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A service account with suitable privileges assigned should be able to connect to DFP services
Actual behavior
Attempts to connect to DFP with a valid service account result in Python AttributeError, apparently because GoogleServiceAccountClient.Refresh.proxy_config returns None.
from googleads import dfp
from googleads import oauth2
# OAuth2 credential information. In a real application, you'd probably be
# pulling these values from a credential storage.
SERVICE_ACCOUNT_EMAIL = 'fake-pretend@developer.gserviceaccount.com'
KEY_FILE = '/secret/gcskey.p12'
# DFP API information.
APPLICATION_NAME = 'fake-pretend'
def dfp_api_client():
oauth2_client = oauth2.GoogleServiceAccountClient(
oauth2.GetAPIScope('dfp'), SERVICE_ACCOUNT_EMAIL, KEY_FILE)
dfp_client = dfp.DfpClient(oauth2_client, APPLICATION_NAME)
return dfp_client
def main(client):
# directly from https://github.com/googleads/googleads-python-lib/blob/master/examples/dfp/v201602/network_service/get_all_networks.py
# Initialize appropriate service.
network_service = client.GetService('NetworkService', version='v201602')
# Get all networks that you have access to with the current login credentials.
networks = network_service.getAllNetworks()
# Display results.
for network in networks:
print ('Network with network code \'%s\' and display name \'%s\' was found.'
% (network['networkCode'], network['displayName']))
print '\nNumber of results found: %s' % len(networks)
if __name__ == '__main__':
# Initialize client object.
dfp_client = dfp_api_client()
main(dfp_client)
This works entirely as expected at v3.15.0, but fails with the following traceback with v4.0.0 and higher:
Traceback (most recent call last):
File "api-test.py", line 37, in <module>
dfp_client = dfp_api_client()# dfp.DfpClient.LoadFromStorage()
File "api-test.py", line 16, in dfp_api_client
oauth2.GetAPIScope('dfp'), SERVICE_ACCOUNT_EMAIL, KEY_FILE)
File "/Users/thomas/.virtualenvs/tmp-1e8b453a8dbebace/lib/python2.7/site-packages/googleads/oauth2.py", line 203, in __init__
self.Refresh()
File "/Users/thomas/.virtualenvs/tmp-1e8b453a8dbebace/lib/python2.7/site-packages/googleads/oauth2.py", line 236, in Refresh
proxy_info=self.proxy_config.proxy_info,
AttributeError: 'NoneType' object has no attribute 'proxy_info'
Steps to reproduce
Install googleads 3.15.0
Attempt connection to DFP API using a service account, which should work
upgrade to googleads 4.x
Attempt connection again
The text was updated successfully, but these errors were encountered:
Closing as this has been open for some time without any response, feel free to reopen if it remains reproducible and you can provide additional information.
Expected behavior
A service account with suitable privileges assigned should be able to connect to DFP services
Actual behavior
Attempts to connect to DFP with a valid service account result in Python
AttributeError
, apparently becauseGoogleServiceAccountClient.Refresh.proxy_config
returnsNone
.Information
Some of my code started failing following
googleads
upgrade. To isolate the behavior togoogleads
, I composed the following simple test case, to connect to the DFP network service (based mainly on copy and paste from https://github.com/googleads/googleads-python-lib/tree/master/examples/dfp)This works entirely as expected at v3.15.0, but fails with the following traceback with v4.0.0 and higher:
Steps to reproduce
The text was updated successfully, but these errors were encountered: