This code will fix it
def new_folder(self, folder_name, path=None, location='local'):
"""Create a new folder on OctoPrint's file system
Note: Folder creation is only supported on the local file system.
"""
files = {
'foldername': (None, folder_name),
}
if path:
files['path'] = (None, path)
return self._post('/api/files/{}'.format(location), files=files)