python script to create github repo (#178)

This commit is contained in:
HARISH KUMAR TIWARI 2020-10-06 15:57:57 +05:30 committed by GitHub
parent 5e38bca219
commit 196815c664
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 49 additions and 0 deletions

View File

@ -0,0 +1,15 @@
# Github Repo Creator
A simple python script which will take git username , git token, git repo name and description from user and it will create a github repo.
## How to create github token [https://docs.github.com/en/free-pro-team@latest/github/authenticating-to-github/creating-a-personal-access-token]
## Libraries Required
1. Requests: HTTP for Humans
`$pip install requests`
## Usage
1. Go to the script's folder and open command prompt.
2. Run command : `$python3 git_repo_creator.py
## Example
`$python3 git_repo_creator.py

View File

@ -0,0 +1,33 @@
# Script Name : git_repo_creator.py
# Author : Harish Tiwari
# Created : 2nd October 2020
# Last Modified : -
# Version : 1.0.0
# Modifications :
# Description : This python script will create a github repo from command line.
import requests
import json
user_name = input("Enter your github user name: ")
print(user_name)
github_token = input("Enter your github token: ")
print(github_token)
repo_name = input("Enter your repo Name: ")
print(repo_name)
repo_description = input("Enter your repo description: ")
print(repo_description)
payload = {'name': repo_name, 'description': repo_description, 'auto_init': 'true'}
repo_request = requests.post('https://api.github.com/' + 'user/repos', auth=(user_name,github_token), data=json.dumps(payload))
if repo_request.status_code == 422:
print("Github repo already exists try wih other name.")
elif repo_request.status_code == 201:
print("Github repo has created successfully.")
elif repo_request.status_code == 401:
print("You are unauthorized user for this action.")

View File

@ -154,6 +154,7 @@ So far, the following projects have been integrated to this repo:
| [Py_Cleaner](Py_Cleaner) | [Abhishek Dobliyal](https://github.com/Abhishek-Dobliyal)
|[Send messages to sqs in parallel](send_sqs_messages_in_parallel)|[Jinam Shah](https://github.com/jinamshah)|
|[Codeforces Checker](codeforcesChecker)|[Jinesh Parakh](https://github.com/jineshparakh)|
|[Github repo creator](https://github.com/hastagAB/Awesome-Python-Scripts/tree/master/Git_repo_creator)|[Harish Tiwari ](https://github.com/optimist2309)
## How to use :