def __init__(self):
        '''Creating a google drive authenticated object so that we
        can pass it around in google_upload.py to do various tasks. Need
        to have a json like object in environment variables that holds the
        service account credentials'''
        gauth = GoogleAuth()
        scope = ['https://www.googleapis.com/auth/drive']

        auth_json = json.loads(os.environ['GDRIVE_AUTH_PASSWORD'])
        gauth.credentials = ServiceAccountCredentials.from_json_keyfile_dict(
            auth_json, scope)

        self.drive = GoogleDrive(gauth)
Пример #2
0
    ProjectReviewRecordAdminForm,
)
from app.project.forms import *
from app.main.models import User, MailInfo
from pydrive.auth import ServiceAccountCredentials, GoogleAuth
from pydrive.drive import GoogleDrive
from flask_mail import Message
from itsdangerous import TimedJSONWebSignatureSerializer

import pandas as pd

gauth = GoogleAuth()
keyfile_dict = requests.get(
    os.environ.get('GOOGLE_APPLICATION_CREDENTIALS')).json()
scopes = ['https://www.googleapis.com/auth/drive']
gauth.credentials = ServiceAccountCredentials.from_json_keyfile_dict(
    keyfile_dict, scopes)
drive = GoogleDrive(gauth)

GANTT_ACTIVITIES = dict([
    (1, '1. พัฒนาโครงร่างการวิจัยและเครื่องมือการวิจัย'),
    (2, '2. เสนอโครงร่างการวิจัยเพื่อขอรับการพิจารณาจริยธรรมฯ'),
    (3, '3. เสนอขอรับทุนอุดหนุนการวิจัย'),
    (4, '4. ผู้ทรงคุณวุฒิตรวจสอบและแก้ไข'),
    (5, '5. ติดต่อประสานงานเพื่อขอเก็บข้อมูล'),
    (6, '6. ดำเนินการเก็บรวบรวมข้อมูล'),
    (7, '7. วิเคราะห์ผลการวิจัยและอภิปรายผล'),
    (8, '8. จัดทำรายงานการวิจัยและเตรียมต้นฉบับตีพิมพ์งานวิจัย')
])

STIN_EMAIL = os.environ.get('MAIL_USERNAME')
Пример #3
0
def initialize_gdrive():
    gauth = GoogleAuth()
    scopes = ['https://www.googleapis.com/auth/drive']
    gauth.credentials = ServiceAccountCredentials.from_json_keyfile_dict(
        json_keyfile, scopes)
    return GoogleDrive(gauth)