Summary: I can't make it run

Details:

First, I'm new to adwords though an old hand at python, and have some
familiarity with SOAP programming and ZSI. We have working (someone
else's) non API library code using SOAPpy, but we want to upgrade to
using the librariy (in part because SOAPpy doesn't seem to be working
with Python 2.7). I've successfully done the cURL example in the
overview, so the account I'm using appears to be working in hte sandbox.

I have managed to install it in a 2.7 virtualenv, including installing
ZSI first[1]. And I've run the configure script, turning on all the
debugging options. The library README suggests running
get_unit_count.py (from the v200909 examples directory). It manages to
get an auth token, but fails to get info, with a CannotSendHeader
exception from httplib if I don't patch anything.

For completeness, I've tried it under python 2.6 and 2.5 with the same
result. And I tried the v201008 version of the example code.

This particular problem seems to be related to
adspygoogle/common/zsi/HttpsConnectionHandler.py's decision to gzip the
request[2]. This results in endheaders being called from within a call
to endheaders, after the outer call has already marked the
HTTPConnection state as _CS_REQ_SENT[3].

If I patch the code to never gzip the request leads to a long wait,
then one gets a BadStatusLine exception, also from httplib, in
_read_status(), in begin(), called on the response by getresponse() in
adspygoogle/common/zsi/HttpConnectionHandler.py. (This hasn't been
tried with other Python versions yet.)

My questions:

Are these example code pieces still expected to work, or is the README
out of date? Have they been revision tested lately? Am I jusst missing
hte obvious? Is there any known problem with running in a virtualenv?

Bill

[1] I did have to patch PyXML to get it to install without errors. ZSI
requires PyXML even if I choose to use ElementTree,, and two of its
modules use "as" as a variable name, which has become a reserved word
in 2.7. I made them "As" in the untarred source, then pointed pip at it.

[2] The code seems to be trying hard to not decide to compress this,
but it's looking for "Content-Type" in the headers, and what's there
is "Content-type".

[3] This code is darned hard to debug, given the adjustments it makes
to sys.stdout. Stack overflow has some articles on how to get around
this. Basicly you want ot look at the definition of set_trace() in
pdb.py, then pass "stdout=sys.__stdout__" to the pdb.Pdb()
constructtor, and otherwise emmulate set_trace().

-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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