def get_gmail_service(user): storage = Storage(CredentialsModel, 'id', user, 'credential') credential = storage.locked_get() http = httplib2.Http() if credential.refresh_token == None: return None http = credential.authorize(http) gmail_service = build("gmail", "v1", http=http) return gmail_service
def get_storage(user): storage = Storage(CredentialsModel, 'id', user, 'credential') credential = storage.locked_get() return render_to_response('mailage/created.html', {'message': inspect.getmembers(credential)})