Buy Me a Coffee? Your support is much appreciated!
PayPal Me: https://www.paypal.me/jiejenn/5
Venmo: @Jie-Jenn
Source Code:
from googleapiclient.http import MediaFileUpload
from Google import Create_Service
CLIENT_SECRET_FILE = 'client-secret.json'
API_NAME = 'drive'
API_VERSION = 'v3'
SCOPES = ['https://www.googleapis.com/auth/drive']
service = Create_Service(CLIENT_SECRET_FILE, API_NAME, API_VERSION, SCOPES)
# Upload a file
file_metadata = {
'name': 'drink.png',
'parents': ['<folder id 1>', '<folder id 2>']
}
media_content = MediaFileUpload('coffee.png', mimetype='image/png')
file = service.files().create(
body=file_metadata,
media_body=media_content
).execute()
print(file)
# Replace Existing File on Google Drive
file_id = '<file id>'
media_content = MediaFileUpload('mp4.png', mimetype='image/png')
service.files().update(
fileId=file_id,
media_body=media_content
).execute()

File “c:\Users\JANESH\private app\drive.py”, line 30, in
from google import Create_Service
ImportError: cannot import name ‘Create_Service’
Im getting this error i dont know wat to do plss help me
It is need arquive “Google.py in path wich all config, is include function “Create_Service”. Find lesson 1 in Google Drive API than him author
use create_service not Create_Service