Hi,

I’m trying to get Adwords reporting data through API call.

 

When I execute the get_customer_campaign.py script I get the following 
error message “socket.error: [Errno 101] Network is unreachable”.

 

I did a “echo $http_proxy” on the terminal and it returned me 
http://w1proxy-vip.web1.xxxx.net:3128. That tells me the http proxy is set 
right.


I have attached the error message and code. 


I would really appreciate any suggestions on this. Thanks.

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and Google+:
https://googleadsdeveloper.blogspot.com/
https://plus.google.com/+GoogleAdsDevelopers/posts
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API Forum" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"AdWords API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
Visit this group at https://groups.google.com/group/adwords-api.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/61b07556-8b3a-4ebf-8561-d26917d94395%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
here is the error message"
*****************************************************************************************************************
Traceback (most recent call last):
  File "./get_customer_campaign.py", line 35, in <module>
    CLIENT_CUSTOMER_ID)
  File "./get_customer_campaign.py", line 26, in main
    developer_token, oauth2_client, user_agent, client_customer_id)
  File 
"/home/gsettu/python_virtual_envs/Adwords/lib/python2.7/site-packages/googleads/adwords.py",
 line 225, in                                                       __init__
    self.oauth2_client.Refresh()
  File 
"/home/gsettu/python_virtual_envs/Adwords/lib/python2.7/site-packages/googleads/oauth2.py",
 line 164, in R                                                      efresh
    self.disable_ssl_certificate_validation)))
  File 
"/home/gsettu/python_virtual_envs/Adwords/lib/python2.7/site-packages/oauth2client/client.py",
 line 633, i                                                      n refresh
    self._refresh(http.request)
  File 
"/home/gsettu/python_virtual_envs/Adwords/lib/python2.7/site-packages/oauth2client/client.py",
 line 842, i                                                      n _refresh
    self._do_refresh_request(http_request)
  File 
"/home/gsettu/python_virtual_envs/Adwords/lib/python2.7/site-packages/oauth2client/client.py",
 line 874, i                                                      n 
_do_refresh_request
    self.token_uri, method='POST', body=body, headers=headers)
  File 
"/home/gsettu/python_virtual_envs/Adwords/lib/python2.7/site-packages/httplib2/__init__.py",
 line 1609, in                                                       request
    (response, content) = self._request(conn, authority, uri, request_uri, 
method, body, headers, redirections, c                                          
            achekey)
  File 
"/home/gsettu/python_virtual_envs/Adwords/lib/python2.7/site-packages/httplib2/__init__.py",
 line 1351, in                                                       _request
    (response, content) = self._conn_request(conn, request_uri, method, body, 
headers)
  File 
"/home/gsettu/python_virtual_envs/Adwords/lib/python2.7/site-packages/httplib2/__init__.py",
 line 1272, in                                                       
_conn_request
    conn.connect()
  File 
"/home/gsettu/python_virtual_envs/Adwords/lib/python2.7/site-packages/httplib2/__init__.py",
 line 1075, in                                                       connect
    raise socket.error, msg
socket.error: [Errno 101] Network is unreachable

*****************************************************************************************************************

here is the script get_customer_campaign.py:

#!/bin/env mlb_run_python_with_virtualenv

from googleads import adwords
from googleads import oauth2

# OAuth 2.0 credential information. In a real application, you'd probably be
# pulling these values from a credential storage.
CLIENT_ID = ''
CLIENT_SECRET = ''
REFRESH_TOKEN = ''

# AdWords API information.
DEVELOPER_TOKEN = ''
USER_AGENT = ''
CLIENT_CUSTOMER_ID = ''


def main(client_id, client_secret, refresh_token, developer_token, user_agent,
             client_customer_id):
  
  oauth2_client = oauth2.GoogleRefreshTokenClient(
      client_id, client_secret, refresh_token)
          
  adwords_client = adwords.AdWordsClient(
      developer_token, oauth2_client, user_agent, client_customer_id)

  customer = adwords_client.GetService('CustomerService').get()
  print 'You are logged in as customer: %s' % customer['customerId']

if __name__ == '__main__':
  main(CLIENT_ID, CLIENT_SECRET, REFRESH_TOKEN, DEVELOPER_TOKEN, USER_AGENT,
       CLIENT_CUSTOMER_ID)
**************************************************************************************************

Reply via email to