gavs
gavs

Reputation: 274

Analytics API + Python Server, NotImplementedError Hello Analytics

A little background: I've been trying to make a restful server that can query and insert via the management API. After banging my head against the wall using node.js and javascript I switched over to python knowing it has more support.

Currently I am trying to follow the GA Tutorial: Hello Analytics API with a slight twist. I trigger the what was the main method in hello_analytics_api_v3.py when trying to access a particular end point on the server. This is only for testing. The method is called insertExperiment and attempts to insert an experiment into a private Google Analytics account.

However I'm always receiving the exception: NotImplementedError('The gflags library must be installed to use tools.run(). Please install gflags or preferrably switch to using tools.run_flow().',)

Here is the full trace stack:

File "/0zzz/bottle.py", line 764, in _handle

return route.call(**args) 

File "/0zzz/bottle.py", line 1575, in wrapper

rv = callback(*a, **ka) 

File "server.py", line 39, in server_static

hello_analytics_api_v3.insertExperiment("xxxxxxx", "xxxxxxxxx", "xxxxxx", experiment_body) 

File "/0zzz/hello_analytics_api_v3.py", line 11, in insertExperiment

service = hello_analytics_api_v3_auth.initialize_service() 

File "/0zzz/hello_analytics_api_v3_auth.py", line 32, in initialize_service

credentials = prepare_credentials() 

File "/0zzz/hello_analytics_api_v3_auth.py", line 25, in prepare_credentials

credentials = run(FLOW, storage) 

File "/0zzz/oauth2client/tools.py", line 241, in run

'The gflags library must be installed to use tools.run(). ' 

NotImplementedError: The gflags library must be installed to use tools.run(). Please install gflags or preferrably switch to using tools.run_flow().

A few extra notes:

Thank you for any help you can provide!

Upvotes: 5

Views: 2824

Answers (2)

Azambuja
Azambuja

Reputation: 1

You need to install gflags library.

$ wget https://python-gflags.googlecode.com/files/python-gflags-2.0.tar.gz

$ tar xfvz python-gflags-2.0.tar.gz ; cd python-gflags-2.0

$ python setup.py install

Upvotes: 0

BushMinusZero
BushMinusZero

Reputation: 1292

I received the same error while running through a tutorial for google APIs called 'Google APIs Console Help'. The fix was simple in my case, just update the gflags library:

easy_install --upgrade python-gflags

Upvotes: 11

Related Questions