Code Monkey home page Code Monkey logo

Comments (3)

hagemouse avatar hagemouse commented on May 25, 2024 1
gauth = GoogleAuth()
gauth.LoadCredentialsFile("mycreds.txt")
if not gauth.credentials:
    gauth.LocalWebserverAuth()
elif gauth.access_token_expired:
    try:
        gauth.Refresh()
    except Exception as e:
        gauth.Authorize()
else:
    gauth.Authorize()

gauth.SaveCredentialsFile("mycreds.txt")
drive = GoogleDrive(gauth)

from pydrive2.

shcheklein avatar shcheklein commented on May 25, 2024

@heysmileyface I would recommend taking a look here https://iterative.github.io/PyDrive2/docs/build/html/oauth.html#automatic-and-custom-authentication-with-settings-yaml

and probably you can see some example here as well- https://github.com/iterative/PyDrive2/blob/master/pydrive2/test/test_oauth.py

@hagemouse PyDrive takes care of refreshing the token, unless something is wrong you don't need to refresh ti manually. It also can save credentials for you.

from pydrive2.

thangisme avatar thangisme commented on May 25, 2024

@shcheklein Can you please do a simple example? I tried above code by @hagemouse, but it threw errors. I can't understand the docs enough to get it running

from pydrive2.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.