vlead / build-vlabs-on-openedx

This repo contains automation of import/export vlabs courses onto production/testing OpenedX platform ( vlabs.ac.in)
Other
0 stars 0 forks source link

Write a python script to clone all repositories from vlabs-on-openedx organization #2

Open sivashankerN opened 6 years ago

sivashankerN commented 6 years ago

clone all repositories from vlabs-on-openedx organization using github apis

sivashankerN commented 6 years ago

Following api displays details of each repository of the organization https://api.github.com/orgs/vlabs-on-openedx/repos

for more details about github apis see this page https://api.github.com/

sravanthimodepu commented 6 years ago

Following api displays the details of each repository of the organization and the "per_page=200" gives the number of repositories to be displayed in a page. https://api.github.com/orgs/vlabs-on-openedx/repos?per_page=200

sivashankerN commented 6 years ago

written python script to list down the repositories to be cloned. https://github.com/vlead/build-vlabs-on-openedx/commit/695e6f6a436546c11b819a4dee2cc662f13eedd9

kraghupathi commented 6 years ago

Following api to clone all repositories in one organization. curl -s https://api.github.com/users/[username]/repos?per_page=200 | python -c $'import json, sys, os\nfor repo in json.load(sys.stdin): os.system("git clone " + repo["clone_url"])'

sravanthimodepu commented 6 years ago

Following python code used to tar the git repositories :

  `import tarfile

    with tarfile.open( folder_path + ".tar.gz", "w:gz" ) as tar:

            for name in os.listdir( path ):

                 tar.add(name)`
sravanthimodepu commented 6 years ago

Below code downloads the files from web using wget in python

    `import os 

     os.system("wget https://api.github.com/orgs/vlabs-on-openedx/repos?per_page=92")`