you need to get root folder first where you want to create folders by get_folder_by_server_relative_url
and then call folders end point -
for e.g. here i want to create a folder under root folder i.e. Shared Documents
context.web.get_folder_by_server_relative_url("Shared%20Documents").folders.add(<your_folder_name>).execute_query()
context you can get it either from client ID and secret or user credentials. Please check below code to get context from user credentials
context = ClientContext('https://sites.ey.com/sites/<site_name>')
user_credentials = UserCredential(<your_username>, <your_password>)
context.with_credentials(user_credentials)
I have used package - Office365-REST-Python-Client