mirror of
https://git.lecygnenoir.info/LecygneNoir/prismedia.git
synced 2025-10-03 09:29:16 +02:00
Check if scopes are corrects in youtube credentials
This commit is contained in:
parent
070408bb67
commit
75aa36e1aa
1 changed files with 11 additions and 0 deletions
|
@ -9,6 +9,7 @@ import time
|
||||||
import copy
|
import copy
|
||||||
import json
|
import json
|
||||||
from os.path import splitext, basename, exists
|
from os.path import splitext, basename, exists
|
||||||
|
import os
|
||||||
import google.oauth2.credentials
|
import google.oauth2.credentials
|
||||||
import datetime
|
import datetime
|
||||||
import pytz
|
import pytz
|
||||||
|
@ -80,6 +81,16 @@ def get_authenticated_service():
|
||||||
return build(API_SERVICE_NAME, API_VERSION, credentials=credentials, cache_discovery=False)
|
return build(API_SERVICE_NAME, API_VERSION, credentials=credentials, cache_discovery=False)
|
||||||
|
|
||||||
|
|
||||||
|
def check_authenticated_scopes():
|
||||||
|
if exists(CREDENTIALS_PATH):
|
||||||
|
with open(CREDENTIALS_PATH, 'r') as f:
|
||||||
|
credential_params = json.load(f)
|
||||||
|
# Check if all scopes are present
|
||||||
|
if credential_params["_scopes"] != SCOPES:
|
||||||
|
logging.warning("Youtube: Credentials are obsolete, need to re-authenticate.")
|
||||||
|
os.remove(CREDENTIALS_PATH)
|
||||||
|
|
||||||
|
|
||||||
def initialize_upload(youtube, options):
|
def initialize_upload(youtube, options):
|
||||||
path = options.get('--file')
|
path = options.get('--file')
|
||||||
tags = None
|
tags = None
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue