Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

400 error #2

Open
toto123 opened this issue Jan 24, 2010 · 1 comment
Open

400 error #2

toto123 opened this issue Jan 24, 2010 · 1 comment

Comments

@toto123
Copy link

toto123 commented Jan 24, 2010

few days ago,i tried python-googleanalytics,and it worked very well and i excited much.but today,i get a 400 error with the same account and profile.
this :
Python 2.6.4 (r264:75708, Oct 26 2009, 08:23:19) [MSC v.1500 32 bit (Intel)] on

win32

Type "help", "copyright", "credits" or "license" for more information.

from googleanalytics import Connection as C

import datetime

c=C('[email protected]','j1wrsxws')

a=c.get_account('xdba.xoom.it')

start=datetime.date(2009,12,01)

end=datetime.date(2010,1,22)

data=a.get_data(start,end,['pageviews'])

Traceback (most recent call last):

File "", line 1, in

File "build\bdist.win32\egg\googleanalytics\account.py", line 174, in get_data

File "build\bdist.win32\egg\googleanalytics\connection.py", line 113, in make_

request

googleanalytics.exception.GoogleAnalyticsClientError: GAError: HTTP Error 400: B

ad Request

data=a.get_data(start,end,['pageviews'])

Traceback (most recent call last):

File "", line 1, in

File "build\bdist.win32\egg\googleanalytics\account.py", line 174, in get_data

File "build\bdist.win32\egg\googleanalytics\connection.py", line 113, in make_

request

googleanalytics.exception.GoogleAnalyticsClientError: GAError: HTTP Error 400: B

ad Request

a

<Account: ga:xbao.xoom.it>

@barmassimo
Copy link

Please try this:

data=a.get_data(start,end,metrics=['pageviews'])

it worked for me!

btw for the author: it would be nice to print the body of the response when you get a HTTPError (like a 400), for example (in connection.py)

try:
  response = urllib2.urlopen(request)
except urllib2.HTTPError, e:
  if DEBUG:
      print e.read()
  raise GoogleAnalyticsClientError(e)
return response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants