Hello,

I encountered a problem when running the example code to get a unit
count for the sandbox account. I got an internal server error when
running get_unit_count.py as suggested in
http://code.google.com/p/google-api-adwords-python-lib/wiki/Readme:

*** Outgoing HTTP headers
**********************************************
User-Agent: ZSI 2.0.0 (http://pywebsvcs.sf.net); PyXML v0.8.3
************************************************************************
*** Outgoing SOAP
******************************************************
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/
encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/";
xmlns:ZSI="http://www.zolera.com/schemas/ZSI/"; xmlns:xsd="http://
www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-
instance">
 <SOAP-ENV:Header>
  <RequestHeader xmlns="https://adwords.google.com/api/adwords/info/
v200909" xmlns:ns1="https://adwords.google.com/api/adwords/cm/
v200909">
   <ns1:authToken>xxxxxx</ns1:authToken>
   <ns1:userAgent>AwApi-Python-12.1.0|GoogleTest</ns1:userAgent>
   <ns1:developerToken>myacco...@gmail.com++gbp</ns1:developerToken>
  </RequestHeader>
 </SOAP-ENV:Header>
 <SOAP-ENV:Body xmlns:ns1="https://adwords.google.com/api/adwords/info/
v200909">
  <ns1:get xmlns:ns1="https://adwords.google.com/api/adwords/info/
v200909">
   <ns1:selector>
    <ns1:dateRange xmlns:ns2="https://adwords.google.com/api/adwords/
cm/v200909">
     <ns2:min>2010801</ns2:min>
     <ns2:max>2010816</ns2:max>
    </ns1:dateRange>
    <ns1:apiUsageType>UNIT_COUNT</ns1:apiUsageType>
   </ns1:selector>
  </ns1:get>
 </SOAP-ENV:Body>
</SOAP-ENV:Envelope>
************************************************************************
*** Incoming HTTP headers
**********************************************
500 Internal Server Error
Content-Type: text/xml; charset=UTF-8
Content-Encoding: gzip
Transfer-Encoding: chunked
Date: Mon, 16 Aug 2010 15:20:12 GMT
Expires: Mon, 16 Aug 2010 15:20:12 GMT
Cache-Control: private, max-age=0
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block
Server: GSE
************************************************************************
*** Incoming SOAP
******************************************************
<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/";>
 <soap:Body>
  <soap:Fault>
   <faultcode>soap:Server</faultcode>
   <faultstring>Fault occurred while processing.</faultstring>
  </soap:Fault>
 </soap:Body>
</soap:Envelope>
************************************************************************

The problem seems to be the date formatting, where <ns2:min>2010801</
ns2:min> should be <ns2:min>20100801</ns2:min> etc.

In examples/adspygoogle/adwords/v200909/get_unit_count.py

lines 44 -> 48
selector = {
    'dateRange': {
        'min': '%s%s01' % (today.year, today.month),
        'max': '%s%s%s' % (today.year, today.month, today.day)
    },

today.month should be formatted to supply a month as two digit always;
presently it formats August as '8' rather than '08' on my system.

Correcting this date formatting results in a successful request to the
service.

-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and discussion group:
http://adwordsapi.blogspot.com
http://groups.google.com/group/adwords-api
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API Forum" group.
To post to this group, send email to adwords-api@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en

Reply via email to