awacke1 commited on
Commit
c0b6de7
·
1 Parent(s): 18544d7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -31
app.py CHANGED
@@ -1,38 +1,14 @@
1
  import streamlit as st
2
- from github import Github
3
  import requests
 
4
 
 
 
 
5
  # Set up the Streamlit app
6
  st.title("GitHub Repository Downloader")
7
 
8
- # Get user input for GitHub repository details
9
- owner = st.text_input("Enter the repository owner:")
10
- repo = st.text_input("Enter the repository name:")
11
-
12
- # Create a PyGitHub object for the repository
13
- g = Github()
14
- repository = g.get_repo(f"{owner}/{repo}")
15
-
16
- # Get all files in the repository
17
- files = repository.get_contents("")
18
-
19
- # Create a list to store the URLs of the files to download
20
- urls_to_download = []
21
-
22
- # Loop through each file and check if it's a data file or markdown file
23
- for file in files:
24
- if file.name.endswith(".csv") or file.name.endswith(".md"):
25
- urls_to_download.append(file.download_url)
26
 
27
- # If there are files to download, create a button to start the download
28
- if len(urls_to_download) > 0:
29
- if st.button("Download Files"):
30
- for url in urls_to_download:
31
- # Download the file using the requests library
32
- response = requests.get(url)
33
- # Save the file with the original name in the current working directory
34
- with open(f"./{url.split('/')[-1]}", "wb") as file:
35
- file.write(response.content)
36
- st.success("Download complete!")
37
- else:
38
- st.write("No data or markdown files found in the repository.")
 
1
  import streamlit as st
 
2
  import requests
3
+ import github import asyncio
4
 
5
+ async def main(): client = await github.GHClient()
6
+
7
+
8
  # Set up the Streamlit app
9
  st.title("GitHub Repository Downloader")
10
 
11
+ user = await client.get_user(user='GithubPythonBot')
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
12
 
13
+ print(user)
14
+ print(user.html_url)