A Python client for accessing Google Analytics data (my project!)

A Python client for accessing Google Analytics data (my project!)

So the Google Analytics API came out last night. Up until now, most people were using a pretty flaky Python API that downloaded CSV reports of Data.

Now that there’s a real API, I wanted to get work started on a real Python Client, so that’s what I did.

I’m developing the module using Buildout so it should be pretty easy for anyone to fork my github project and start hacking on it immediately. I’ll gladly accept pull requests! Most everything you need to know is in the README.

Current Progress

Right now I’ve really only gotten the authentication and account list pulling parts incorporated. There’s not much in the way of data access just yet, but it looks like it should be pretty easy to get going.

I’d take a look at tests.py to get an idea of what’s possible at the moment (again, not much). If you want to get the most out of the client right now, make a file in your home directory named .pythongoogleanalytics and dump in something like this:

google_account_email = youraccount@gmail.com 
google_account_password = yourpassword

If you want to run the whole test suite, you can also add in a section called [Accounts] with a directive called test_profiles_ids like so:

test_profiles_ids = 1023 9282001 19283

Otherwise we wouldn’t be able to know which Profile IDs we could pull to test on.

I’m trying to model the Python client on a nice client I’ve used in the past, mainly Mitch’s Boto client for Amazon’s Web Services.