From daa89fb86c02bf7e52940afa37de64576036aff5 Mon Sep 17 00:00:00 2001 From: optmist2309 Date: Sat, 3 Oct 2020 02:12:18 +0530 Subject: [PATCH] two python scripts updated --- readme.md | 2 ++ scripts/git_repo_creator.py | 31 +++++++++++++++++++++++++++++++ scripts/qr_code.py | 8 ++++++++ 3 files changed, 41 insertions(+) create mode 100644 scripts/git_repo_creator.py create mode 100644 scripts/qr_code.py diff --git a/readme.md b/readme.md index 78f4a72..fca8c8e 100755 --- a/readme.md +++ b/readme.md @@ -34,3 +34,5 @@ 1. **32_stock_scraper.py**: Get stock prices 1. **33_country_code.py**: Convert country code to country name 1. **34_git_all_repos.py**: Clone all repositories from a public user or organization on Github. Usage: `python git_all_repos.py users USER_NAME` or `python git_all_repos.py orgs ORG_NAME` +1. **35_qr_code.py**: Convert user input text to qr code image +1. **36_git_repo_creator.py**: Create github repo from command line. diff --git a/scripts/git_repo_creator.py b/scripts/git_repo_creator.py new file mode 100644 index 0000000..8191a81 --- /dev/null +++ b/scripts/git_repo_creator.py @@ -0,0 +1,31 @@ +# 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 tokne: ") +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.") diff --git a/scripts/qr_code.py b/scripts/qr_code.py new file mode 100644 index 0000000..1580f2a --- /dev/null +++ b/scripts/qr_code.py @@ -0,0 +1,8 @@ +import pyqrcode +import png +from pyqrcode import QRCode + + +user_input = raw_input("Enter web page address or info you want to convert into qr code: ") +user_input = pyqrcode.create(user_input) +user_input.png('myqr.png', scale = 6)