I tried to clone a repository from git using GitPython in python function. I used GitPython library for cloning from git in my python function and my code snippet as follows
From toanant's answer.
This works for me with the --single-branch option
repo = Repo.clone_from( 'http://user:password@github.com/user/project.git --single-branch', '/home/antro/Project/', branch='master' )