Skip to content

Commit 21755e2

Browse files
committed
Add main.py as example script
1 parent 37b3cf5 commit 21755e2

1 file changed

Lines changed: 31 additions & 0 deletions

File tree

main.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
from funcs.replit_scrapper import ReplitScrapper
2+
from funcs.github_archiver import GithubArchiver
3+
import os
4+
import zipfile
5+
from dotenv import load_dotenv
6+
load_dotenv()
7+
8+
WDIR = os.path.abspath(os.path.dirname(__name__))
9+
10+
if __name__ == "__main__":
11+
test_url = "https://replit.com/@pythondojoarchi/SlipperyGargantuanDebuggers"
12+
project_name = "SlipperyGargantuanDebuggers"
13+
14+
# Download repo files as zip
15+
scrapper = ReplitScrapper(login_name=os.environ['EMAIL'], login_password=os.environ['PASSWORD'])
16+
scrapper.set_replit_url(test_url)
17+
scrapper.run()
18+
19+
# Unzip downloaded zip file
20+
download_folder_path = os.path.join(WDIR, "screen-shots")
21+
full_file_path = os.path.join(download_folder_path, project_name+".zip")
22+
extracted_folder_path = os.path.join(download_folder_path, project_name)
23+
zipfile.ZipFile(full_file_path).extractall(extracted_folder_path)
24+
25+
# Commit target files to Github
26+
archiver = GithubArchiver(
27+
project_name=project_name,
28+
github_access_token=os.environ['GITHUB_ACCESS_TOKEN']
29+
)
30+
archiver.identify_target_files()
31+
archiver.commit_to_github()

0 commit comments

Comments
 (0)