from google.oauth2.credentials import Credentials from googleapiclient.errors import HttpError from googleapiclient.discovery import build import io import os from googleapiclient.http import MediaIoBaseUpload
from flask import Flask, request
from os import listdir
from Google import Create_Service
CLIENT_SECRET_FILE = "/home/tchange/mysite/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)
print(None==service) #Gives false , when I run it with pythonanywhere console.
app = Flask(__name__)
@app.route('/' , methods=["GET","POST"])
def hello_world():
if request.method == "POST":
return str(service==None) #it returns true to Client here
else:
return "yo"
That is my app.py. I can use the service when I run it with pythonanywhere python console and it gives false here (print(None==service)). But when I send a http request it returns true to client here (eturn str(service==None))