Skip to content

Instantly share code, notes, and snippets.

@fmartingr
Created August 20, 2014 10:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fmartingr/4385efd123caebf56ad8 to your computer and use it in GitHub Desktop.
Save fmartingr/4385efd123caebf56ad8 to your computer and use it in GitHub Desktop.
python script to clone all codebase repositories using codebase-api and fabric into a codebase exported data folder
# pip install codebase-api fabric
from codebase import CodebaseClient
from fabric.operations import local
CLIENT_ID = 'foo/bar'
CLIENT_KEY = 'key'
client = CodebaseClient(CLIENT_ID, CLIENT_KEY)
projects = client.all_projects()
for project in projects:
print("===> {}".format(project))
repositories = client.repositories(project)
for repo in repositories:
print("- {}".format(repo))
repo_details = client.repository(project, repo)
clone_url = repo_details['clone_url']
local('git clone {} {}/clones/{}'.format(clone_url, project, repo))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment