Last active
September 14, 2022 20:07
-
-
Save oguzhari/7264699830daf4d33529e95e6d133341 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from pydrive.auth import GoogleAuth | |
| def create_user_auth(): | |
| gauth = GoogleAuth() | |
| gauth.LoadCredentialsFile('mycreds.txt') | |
| if gauth.credentials is None: | |
| # Eğer mycreds.txt dosyası yoksa, kullanıcıdan kimlik doğrulaması yapılması istenir. | |
| gauth.LocalWebserverAuth() | |
| elif gauth.access_token_expired: | |
| # Kimlik doğrulaması süresi dolmuşsa yeniden kimlik doğrulaması yapılır. | |
| gauth.Refresh() | |
| else: | |
| # Kimlik doğrulaması geçerliyse kimlik doğrulaması yapılması istenmez. | |
| gauth.Authorize() | |
| # Kimlik doğrulaması sonucunda elde edilen bilgiler mycreds.txt dosyasına kaydedilir. | |
| gauth.SaveCredentialsFile('mycreds.txt') | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment