title: Uploading a folder to Sharepoint using Python, on an O365 tenant with MFA
body: <p>I recently wrote a script that simply put, uploads a folder to sharepoint on my office365 tenant. For obvious reasons, the original auth was done using a service account that only had access to one document library. This worked fine:</p>
  <pre><code>from shareplum import Office365
  from shareplum import Site 
  from shareplum.site import Version
  import os 
  import sys 
  
  folderName = sys.argv[1]
  authcookie = Office365('mySharepoint',username='username',password='password').GetCookies()
  site= Site('mysharepoint/sites/mySite', version=Version.v365, authcookie=authcookie)
  
  for filename in os.listdir('myDir'):
      with open(foldername+&quot;/&quot;+filename, mode='rb') as file: 
          fileContent = file.read()
          folder.upload_file(fileContent,filename)
  
  </code></pre>
  <p>So under current basic auth, this works perfectly fine, it'll loop through whatever directory and upload all my files, be it text or jpgs, to my sharepoint.</p>
  <p>Now the issue is, in production, everything is MFA, so basic auth won't work. I've tried app passwords, but despite flicking every setting applicable in Azure AD, the option simply doesn't exist.</p>
  <p>Is there a simple way to allow this account to upload and go around MFA?</p>