การแสดงลิงค์สำหรับแสดงไฟล์จาก Google drive - MUMT-IT/mis2018 GitHub Wiki
ใช้ pydrive library สำหรับการเชื่อมต่อกับ Google drive
from pydrive.drive import GoogleDrive
from pydrive.auth import ServiceAccountCredentials, GoogleAuth
gauth = GoogleAuth()
scopes = ['https://www.googleapis.com/auth/drive']
gauth.credentials = ServiceAccountCredentials.from_json_keyfile_dict(keyfile_dict, scopes)
drive = GoogleDrive(gauth)
keyfile_dict = requests.get(os.environ.get('GOOGLE_APPLICATION_CREDENTIALS')).tojson()
gauth.credentials = ServiceAccountCredentials.from_json_keyfile(keyfile_dict, scopes)
uploaded_file = drive.CreateFile({'id': file_id})
uploaded_file.FetchMetadata()
url = uploaded_file.get('embedLink')