0

Per the example at https://developers.google.com/slides/quickstart/python, I tried:

$ python manage.py shell --settings=myapp.settings-test

In [1]: from apiclient.discovery import build
   ...: from httplib2 import Http
   ...: from oauth2client import file, client, tools
   ...: SCOPES = 'https://www.googleapis.com/auth/presentations.readonly'
   ...: flow = client.flow_from_clientsecrets('client_secret.json', SCOPES)
   ...: store = file.Storage('credentials.json')
   ...: creds = tools.run_flow(flow, store)
   ...: 

usage: manage.py [--auth_host_name AUTH_HOST_NAME] [--noauth_local_webserver]
                 [--auth_host_port [AUTH_HOST_PORT [AUTH_HOST_PORT ...]]]
                 [--logging_level {DEBUG,INFO,WARNING,ERROR,CRITICAL}]
manage.py: error: unrecognized arguments: shell --settings=myapp.settings-dev
An exception has occurred, use %tb to see the full traceback.

Is there a different way to set up Google Slides from within the django shell? Or what can I do differently to make it work?

I see that someone had a similar question here but I was unable to draw inspiration from it.

Kos
  • 4,890
  • 9
  • 38
  • 42
Vishal
  • 2,097
  • 6
  • 27
  • 45

1 Answers1

0

Settings and then using flags like below did the trick

flow = client.flow_from_clientsecrets('client_secret.json', SCOPES)
flags = tools.argparser.parse_args(args=[])
creds = tools.run_flow(flow, store, flags)

H/t to the answer here

Vishal
  • 2,097
  • 6
  • 27
  • 45