Skip to content
This repository has been archived by the owner on Jan 18, 2025. It is now read-only.

Removal of run() has broken the second example on google developers get_started page #299

Closed
dbenn8 opened this issue Sep 7, 2015 · 10 comments

Comments

@dbenn8
Copy link

dbenn8 commented Sep 7, 2015

Hi all,

I am walking through the second example in the get_started tutorial for use of the API, and the sample code still uses the 'run(flow, storage)' command instead of the new run_flow() function.

Get started page (Installed Application is the second major walkthrough and contains the issue):
https://developers.google.com/api-client-library/python/start/get_started

Downloadable code example with the reference to run():
https://developers.google.com/api-client-library/python/samples/authorized_api_cmd_line_calendar.py

I know this is the code repository, and not the tutorial, but there wasn't an available mechanism for leaving feedback there, and I assume you all are in a better position to pass this information along than I am.

Sorry if I'm barking up the wrong tree.

Very Best,
-Dan

@dbenn8
Copy link
Author

dbenn8 commented Sep 7, 2015

Eventually found this which helps:
http://stackoverflow.com/questions/25422545/which-flag-for-run-flow-will-simulate-the-now-deprecated-run/27736269#27736269

Still, being new to all this I lost a few hours on it.

had to:

import argparse at the top of my file

and add code to the example:

if credentials is None or credentials.invalid:
        # DB from line 147 /Users/DanielBennett/.virtualenvs/gpmail/lib/python2.7/site-packages/oauth2client/tools.py
        # Create a parser to pass as arg 3 (flags) to run_flow

        parser = argparse.ArgumentParser(
            description=__doc__,
            formatter_class=argparse.RawDescriptionHelpFormatter,
            parents=[t.argparser]) #tools as t
        flags = parser.parse_args(args=[])

        credentials = run_flow(flow, storage, flags)

@dhermes
Copy link
Contributor

dhermes commented Sep 7, 2015

Thanks for pointing this out! We decided to finally remove tools.run() (aka old_run.run()) in the v1.5.0 release since it had been deprecated for 2 years.

@nathanielmanistaatgoogle I assume your team is in charge of the google-api-client-library docs?

@nathanielmanistaatgoogle
Copy link
Contributor

@dbenn8: thanks for the report!

One question: why not just change

credentials = run(flow, storage)

to

credentials = tools.run_flow(flow, storage, tools.argparser.parse_args())

?

@dhermes
Copy link
Contributor

dhermes commented Sep 14, 2015

@nathanielmanistaatgoogle https://developers.google.com/api-client-library/python/start/get_started should be updated ASAP. The api-client-library/... docs are directly tied to the google-api-*-client libraries, so in this case ISTM you guys have ownership of that doc.

@nathanielmanistaatgoogle
Copy link
Contributor

@dhermes I submitted a correction this morning but I'm not sure how often the docs are pushed. Probably within 24 hours but maybe 48?

@dhermes
Copy link
Contributor

dhermes commented Sep 15, 2015

Awesome! Maybe we'll have #304 pushed in 24-48 hours too and all will be good in the world.

@dhermes dhermes closed this as completed Sep 15, 2015
@polyzen
Copy link

polyzen commented Oct 2, 2015

Sorry if I have misunderstood, but this still seems to be an issue.
https://developers.google.com/api-client-library/python/samples/authorized_api_cmd_line_calendar.py

@dhermes
Copy link
Contributor

dhermes commented Oct 2, 2015

@polyzen Thanks for reporting. That example is out-of-date: the run() method has been deprecated (though run_flow() will do the same thing)

It looks like
https://developers.google.com/api-client-library/python/start/get_started
still refers to it and still refers to the run() function.

@nathanielmanistaatgoogle
Copy link
Contributor

Apologies for the delay - I was mistaken about how my change would propagate to the live site. Please confirm that the live documentation is now accurate and this issue is fully resolved?

@dhermes
Copy link
Contributor

dhermes commented Oct 6, 2015

LG on my end

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

No branches or pull requests

4 participants