Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(89)

Issue 5494058: Adding py sample for google analytics core reporting api (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
12 years, 11 months ago by api.nickm1
Modified:
12 years, 7 months ago
CC:
google-api-python-client_googlegroups.com
Visibility:
Public.

Description

Fixed here: http://code.google.com/p/google-api-python-client/source/detail?r=63c6ac00f393ea3596b275953a5f47dd67c1bdc2 closing this

Patch Set 1 #

Patch Set 2 : some minor tweaks #

Total comments: 6

Patch Set 3 : updated code per feedback #

Patch Set 4 : adding new hello world sample, moving to common auth util, cleaning up errors #

Patch Set 5 : fixed minor typo #

Total comments: 26

Patch Set 6 : fixed per your comments #

Patch Set 7 : more typo fixes #

Unified diffs Side-by-side diffs Delta from patch set Stats (+869 lines, -265 lines) Patch
A samples/analytics/client_secrets.json View 1 2 1 chunk +9 lines, -0 lines 0 comments Download
A samples/analytics/core_reporting_v3_reference.py View 1 2 3 4 5 1 chunk +255 lines, -0 lines 0 comments Download
A samples/analytics/hello_analytics_api_v3.py View 1 2 3 4 5 6 1 chunk +176 lines, -0 lines 0 comments Download
M samples/analytics/management_v3_reference.py View 1 2 3 4 5 5 chunks +298 lines, -265 lines 0 comments Download
A samples/analytics/sample_utils.py View 1 2 3 4 5 1 chunk +131 lines, -0 lines 0 comments Download

Messages

Total messages: 10
jcgregorio_google
http://codereview.appspot.com/5494058/diff/4/samples/analytics/core_reporting_v3_reference.py File samples/analytics/core_reporting_v3_reference.py (right): http://codereview.appspot.com/5494058/diff/4/samples/analytics/core_reporting_v3_reference.py#newcode70 samples/analytics/core_reporting_v3_reference.py:70: FLOW = OAuth2WebServerFlow( Please update the sample to use ...
12 years, 10 months ago (2012-01-06 18:52:00 UTC) #1
jcgregorio_google
http://codereview.appspot.com/5494058/diff/10001/samples/analytics/hello_analytics_api_v3.py File samples/analytics/hello_analytics_api_v3.py (right): http://codereview.appspot.com/5494058/diff/10001/samples/analytics/hello_analytics_api_v3.py#newcode164 samples/analytics/hello_analytics_api_v3.py:164: if results.get('rows'): if 'rows' in results: or combine these ...
12 years, 8 months ago (2012-03-06 15:01:59 UTC) #2
nm
fixed them. On Tue, Mar 6, 2012 at 7:01 AM, <jcgregorio@google.com> wrote: > > http://codereview.appspot.com/**5494058/diff/10001/samples/** ...
12 years, 8 months ago (2012-03-06 19:05:44 UTC) #3
jsoneja
http://codereview.appspot.com/5494058/diff/10001/samples/analytics/hello_analytics_api_v3.py File samples/analytics/hello_analytics_api_v3.py (right): http://codereview.appspot.com/5494058/diff/10001/samples/analytics/hello_analytics_api_v3.py#newcode22 samples/analytics/hello_analytics_api_v3.py:22: authorized users first profile ID. Then the sample uses ...
12 years, 8 months ago (2012-03-06 22:33:55 UTC) #4
nm
all done. On Tue, Mar 6, 2012 at 2:33 PM, <jsoneja@google.com> wrote: > > http://codereview.appspot.com/**5494058/diff/10001/samples/** ...
12 years, 8 months ago (2012-03-07 23:33:02 UTC) #5
jsoneja
LGTM
12 years, 8 months ago (2012-03-07 23:41:47 UTC) #6
jcgregorio_google
On 2012/03/07 23:41:47, jsoneja wrote: > LGTM LGTM Be sure to follow the updated submit ...
12 years, 8 months ago (2012-03-08 18:49:16 UTC) #7
api.nickm1
Thanks. Can you add api.nickm@gmail.com as a committer to this project? -Nick On Thu, Mar ...
12 years, 8 months ago (2012-03-09 08:27:28 UTC) #8
api.nickm1
Great updated here: http://code.google.com/p/google-api-python-client/source/detail?r=63c6ac00f393ea3596b275953a5f47dd67c1bdc2 Thanks On 2012/03/09 08:27:28, api.nickm1 wrote: > Thanks. Can you add ...
12 years, 8 months ago (2012-03-12 16:24:24 UTC) #9
api.nickm1
12 years, 7 months ago (2012-04-26 06:30:15 UTC) #10
http://codereview.appspot.com/5494058/diff/4/samples/analytics/core_reporting...
File samples/analytics/core_reporting_v3_reference.py (right):

http://codereview.appspot.com/5494058/diff/4/samples/analytics/core_reporting...
samples/analytics/core_reporting_v3_reference.py:70: FLOW = OAuth2WebServerFlow(
On 2012/01/06 18:52:00, jcgregorio_google wrote:
> Please update the sample to use client_secrets.json.
> 
> See
>
http://code.google.com/p/google-api-python-client/source/browse/samples/plus/...
> 
> Also update management_v3_reference.py in the same way.

Done.

http://codereview.appspot.com/5494058/diff/4/samples/analytics/core_reporting...
samples/analytics/core_reporting_v3_reference.py:144: class View(object):
On 2012/01/06 18:52:00, jcgregorio_google wrote:
> This is a class that carries no state. Delete the class and just use
functions.

Done.

http://codereview.appspot.com/5494058/diff/4/samples/analytics/core_reporting...
samples/analytics/core_reporting_v3_reference.py:163: """Prints general
information about this report."""
On 2012/01/06 18:52:00, jcgregorio_google wrote:
> Document the parameters. Same for all functions.

Done.

http://codereview.appspot.com/5494058/diff/10001/samples/analytics/hello_anal...
File samples/analytics/hello_analytics_api_v3.py (right):

http://codereview.appspot.com/5494058/diff/10001/samples/analytics/hello_anal...
samples/analytics/hello_analytics_api_v3.py:22: authorized users first profile
ID. Then the sample uses this ID to
On 2012/03/06 22:33:55, jsoneja wrote:
> users's

Done.

http://codereview.appspot.com/5494058/diff/10001/samples/analytics/hello_anal...
samples/analytics/hello_analytics_api_v3.py:29: The register the project to use
OAuth2.0 for installed applications.
On 2012/03/06 22:33:55, jsoneja wrote:
> s/The/Then/

Done.

http://codereview.appspot.com/5494058/diff/10001/samples/analytics/hello_anal...
samples/analytics/hello_analytics_api_v3.py:32: into the client_secrest.json
file that is in the same directory as this sample.
On 2012/03/06 22:33:55, jsoneja wrote:
> client_secrets.json

Done.

http://codereview.appspot.com/5494058/diff/10001/samples/analytics/hello_anal...
samples/analytics/hello_analytics_api_v3.py:41: $ python
hello_analytics_api_v3.py --help
On 2012/03/06 22:33:55, jsoneja wrote:
> if we do decide to rename the java sample, we should rename this accordingly.

lets do in another cl since renaming now is a bit tricky

http://codereview.appspot.com/5494058/diff/10001/samples/analytics/hello_anal...
samples/analytics/hello_analytics_api_v3.py:164: if results.get('rows'):
On 2012/03/06 15:01:59, jcgregorio_google wrote:
> if 'rows' in results:
> 
> or combine these two lines into:
> 
> for row in results.get('rows', []):

Done.

http://codereview.appspot.com/5494058/diff/10001/samples/analytics/management...
File samples/analytics/management_v3_reference.py (right):

http://codereview.appspot.com/5494058/diff/10001/samples/analytics/management...
samples/analytics/management_v3_reference.py:49: $ python analytics.py
On 2012/03/06 15:01:59, jcgregorio_google wrote:
> name is wrong

Done.

http://codereview.appspot.com/5494058/diff/10001/samples/analytics/management...
samples/analytics/management_v3_reference.py:54: $ python analytics.py --help
On 2012/03/06 22:33:55, jsoneja wrote:
> here too .. update the name

fixed in the previous patch

http://codereview.appspot.com/5494058/diff/10001/samples/analytics/management...
samples/analytics/management_v3_reference.py:174: for webproperty in
webproperties_response.get('items'):
On 2012/03/06 15:01:59, jcgregorio_google wrote:
> .get('items', []):
> 
> would be safer because then the loop would just be skipped if 'items' is
> missing, as opposed to raising a TypeError, which is what would happen now.
> 
> Here and throughout.

Done.

http://codereview.appspot.com/5494058/diff/10001/samples/analytics/management...
samples/analytics/management_v3_reference.py:175: print 'Kind               =
%s' % webproperty.get('kind')
we did in the past. For readability it seemed easier to look at the code since
everything was on the same line. Generally the use case for this file is just to
look up how to access our APIs data using this library. So while there are lots
of prints, it seems easier to read this way.

On 2012/03/06 15:01:59, jcgregorio_google wrote:
> Have you considered string templates instead of the huge raft of prints?
> 
>   http://docs.python.org/library/string.html#template-strings

http://codereview.appspot.com/5494058/diff/10001/samples/analytics/management...
samples/analytics/management_v3_reference.py:309: for goal_step in
goal_details.get('steps'):
On 2012/03/06 15:01:59, jcgregorio_google wrote:
> for goal_step in goal_details.get('steps', []):
> 
> and you can drop the if.

Done.

http://codereview.appspot.com/5494058/diff/10001/samples/analytics/sample_uti...
File samples/analytics/sample_utils.py (right):

http://codereview.appspot.com/5494058/diff/10001/samples/analytics/sample_uti...
samples/analytics/sample_utils.py:90: """Uses the command-line flags to set the
logging level."""
On 2012/03/06 15:01:59, jcgregorio_google wrote:
> document parameter

Done.

http://codereview.appspot.com/5494058/diff/10001/samples/analytics/sample_uti...
samples/analytics/sample_utils.py:103: def prepare_credentials():
I decided to remove them.

On 2012/03/06 15:01:59, jcgregorio_google wrote:
> Seems gratuitous to break out prepare_credentials and retrieve_service as
> separate functions given how little they do and that only initialize_service
is
> called from outside this file. Either collapse into initialize_service or mark
> them as private and document their parameters.

http://codereview.appspot.com/5494058/diff/10001/samples/analytics/sample_uti...
samples/analytics/sample_utils.py:124: """Builds instance of service from
discovery data and does auth."""
On 2012/03/06 15:01:59, jcgregorio_google wrote:
> document return value

Done.
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b