if ctxAuth.acquireTokenForUser(username, password):
    request = ClientRequest(url, ctxAuth)
requestUrl = '/_api/web/'
data = request.executeQuery(requestUrl=requestUrl)
webTitle = data['d']['Title']
Remote Authentication in SharePoint Online