awacke1/Github-Create-Read-Update-Delete
2
1#Write a streamlit program in short number of lines that has four buttons on a sidebar also with a textbox labeled Github URL. Create python code that performs the four functions with github : Pull & Read, Append and Write, Create a file on github, Delete a file on github.2 3import streamlit as st4 5st.markdown("""6 7https://pypi.org/project/github3api/8github3api9 10https://pypi.org/project/github-archive/11# Install tool12pip3 install github-archive13 14# Install locally15make install16 17""")18 19 20def pull_files_from_github_url(url):21 import os22 23 #client = GitHubAPI()24 #client.get('/rate_limit')['resources']['core']25 26 # Using GitPython library27 # from git import Repo28 29 # Get the directory where the file will be downloaded30 # dir_name = os.path.basename(url).split('.')[0]31 32 # Clone the repo33 # 34 dir_name = 'c:\\users\\awacke1\\'35 Repo.clone_from(url, dir_name)36 37 # Get the list of files38 # repo = Repo(dir_name)39 # return [item.a_path for item in repo.tree.traverse()]40 41url = st.sidebar.text_input("GitHub URL")42url = 'https://github.com/AaronCWacker/Yggdrasil'43 44 45st.sidebar.title('GitHub Functions')46 47if st.sidebar.button("Pull & Read"):48 pull_files_from_github_url(url)49 50if st.sidebar.button("Append & Write"):51 pull_files_from_github_url(url)52 53if st.sidebar.button("Create File"):54 pull_files_from_github_url(url)55 56if st.sidebar.button("Delete File"):57 pull_files_from_github_url(url)58 