简体   繁体   中英

What is the Django equivalent for the Flask example used by Google API Python Client?

I'm trying to follow the examples for getting OAuth up and running with a Python app as described by Google's API.

They use a flask example only.

In the case of this, for example:

@app.route('/test')
def test_api_request():
  if 'credentials' not in flask.session:
    return flask.redirect('authorize')

  # Load credentials from the session.
  credentials = google.oauth2.credentials.Credentials(
      **flask.session['credentials'])
  ... 

How would I know what to replace the **flask.session['credentials'] with in my Django application?
I am still attempting to do the same thing, but without Flask.

What is the Django equivalent for flask.session ?

The code is taken from here: https://developers.google.com/api-client-library/python/auth/web-app#example

Hi there are few resources available in the reference itself you can find some help using these links Using Django

Also, a working sample application is provided by the API guide Sample App

For further information, you should read the OAuth guide .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM