[GA-API] AttributeError: 'module' object has no attribute 'HTTPSConnection'

1,668 views
Skip to first unread message

swami bebop

unread,
May 10, 2010, 12:50:16 PM5/10/10
to google-analytics-api - GA Data Export API
Hi all,

I'm using the python client gdata-2.0.9 to retrieve data feeds from
Google Analytics.
I'm running the same code on a Mac OS 10.6.3 and on a Debian 5.0, both
running python 2.6.5. Here's the bit of the code that instantiates the
client and tries to login

import sys
sys.path.append('lib/gdata-2.0.9/src')
from sys import argv, stderr
from datetime import datetime, timedelta, date
from re import search
import gdata.analytics.client
import glob, os, csv, codecs, cStringIO

def get_logged_in_ga_client(email, password, source):
""" Instantiate a google analytics client and try to login """
ga_client = gdata.analytics.client.AnalyticsClient()
try:
ga_client.client_login(
email = email,
password = password,
source = source,
service = 'analytics',
account_type = 'GOOGLE'
)
except gdata.client.Error as e:
print >>stderr, e
exit(1)
return ga_client

This code executes just fine on the Mac, but gives me the following
error in Debian, which suggests that my python installation may be
missing something, but I can't figure out what:

Traceback (most recent call last):
File "extract_fact_snapshot_daily_pageviews.py", line 156, in
<module>
main()
File "extract_fact_snapshot_daily_pageviews.py", line 151, in main
ga_client = get_logged_in_ga_client(ga_email, ga_password,
source=os.path.basename(argv[0]))
File "extract_fact_snapshot_daily_pageviews.py", line 74, in
get_logged_in_ga_client
account_type = 'GOOGLE'
File "lib/gdata-2.0.9/src/gdata/client.py", line 442, in
client_login
captcha_token=captcha_token, captcha_response=captcha_response)
File "lib/gdata-2.0.9/src/gdata/client.py", line 341, in
request_client_login_token
response = self.http_client.request(http_request)
File "lib/gdata-2.0.9/src/atom/http_core.py", line 420, in request
http_request.headers, http_request._body_parts)
File "lib/gdata-2.0.9/src/atom/http_core.py", line 460, in
_http_request
connection = self._get_connection(uri, headers=headers)
File "lib/gdata-2.0.9/src/atom/http_core.py", line 530, in
_get_connection
return HttpClient._get_connection(self, uri, headers=headers)
File "lib/gdata-2.0.9/src/atom/http_core.py", line 435, in
_get_connection
connection = httplib.HTTPSConnection(uri.host)
AttributeError: 'module' object has no attribute 'HTTPSConnection'


Does anyone know what is going on?
Any help is most appreciated.

Thank you

Marcos

--
You received this message because you are subscribed to the Google Groups "GA Data Export API" group.
To post to this group, send email to google-analytics...@googlegroups.com.
To unsubscribe from this group, send email to google-analytics-data-...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-analytics-data-export-api?hl=en.

Nick

unread,
May 11, 2010, 7:57:14 PM5/11/10
to google-analytics-api - GA Data Export API
hmm...

Per the Python docs: http://docs.python.org/library/httplib.html

HTTPS support is only available if the socket module was compiled with
SSL support.

Do you know if this was enabled?
-Nick

swami bebop

unread,
May 14, 2010, 9:47:32 PM5/14/10
to google-analytics-api - GA Data Export API
Thank you Nick! I think your comment has definitely put me in the
right track,
but the problem now is that I'm unable to "compile the socket module
with SSL support".
I installed openssl-0.9.8g (...and also tried the 1.0.0 version) and
then ran Python2.6.5/configure - make - make install
and keep getting the error:

Failed to build these modules:
_hashlib _ssl

(The truth is, I'm a total python newbie)

Thank you so much for all your help!

Marcos

swami bebop

unread,
May 18, 2010, 2:43:05 PM5/18/10
to google-analytics-api - GA Data Export API
Solved it. All I had to do was:

apt-get install libssl-dev

Then configure, make, and make install inside the Python2.6.5 folder
so
that the installation is able to pick up the ssl library.

Thank you all for your help

Marcos
Reply all
Reply to author
Forward
0 new messages