Coder Social home page Coder Social logo

github-repo-exporter's Introduction

GitHub Repository Exporter

This script exports the names, descriptions, and URLs of all the public repositories for a given GitHub organization to a CSV file.

Prerequisites

  • Python 3
  • requests library
  • Access to the GitHub API

Usage

  1. Clone this repository or download the script.
  2. Install the requests library using pip install requests.
  3. Run the script in your terminal or command prompt using python3 github_scraper.py.
  4. Enter the name of the GitHub organisation when prompted.
  5. A CSV file with the name organisation_name_repos.csv will be generated in the same directory as the script.

Code Explanation

  • The headers for the API request are defined with the Accept key set to application/vnd.github+json.
  • The user is prompted to enter the name of the GitHub organisation.
  • The initial URL for the API request is defined using the format https://api.github.com/orgs/organisation_name/repos.
  • A GET request is sent to the GitHub API in a while loop to retrieve the data for all the public repositories for the organisation.
  • The response from the API is checked for success. If the request is not successful, an error message is printed and the loop is broken.
  • If the request is successful, the JSON data is retrieved and added to the repo_data list.
  • If there are more pages of results, the URL for the next page is retrieved. Otherwise, the loop is exited.
  • The name of the output CSV file is defined using the format organisation_name_repos.csv.
  • The repo_data is written to the CSV file, with the header row defined as ['name', 'description', 'url'].
  • The https:// portion of the repository URL is removed before writing it to the CSV file.

github-repo-exporter's People

Contributors

louisreed avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.