mirror of
https://github.com/hastagAB/Awesome-Python-Scripts.git
synced 2024-11-23 20:11:07 +00:00
python script to create github repo (#178)
This commit is contained in:
parent
5e38bca219
commit
196815c664
15
Git_repo_creator/README.md
Normal file
15
Git_repo_creator/README.md
Normal 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
|
33
Git_repo_creator/git_repo_creator.py
Normal file
33
Git_repo_creator/git_repo_creator.py
Normal 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.")
|
|
@ -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)
|
| [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)|
|
|[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)|
|
|[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 :
|
## How to use :
|
||||||
|
|
Loading…
Reference in New Issue
Block a user