E-slam commited on
Commit
cea9e80
·
verified ·
1 Parent(s): fb908a4

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +24 -3
main.py CHANGED
@@ -18,7 +18,28 @@ os.system(f"git clone {url_with_token}")
18
  # Wait for cloning to complete
19
  time.sleep(10)
20
 
21
- # Copy main.py to current directory, replacing existing files
22
- os.system("cp -f ESearch_FletV01/app.py ./")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23
 
24
- os.system("python app.py")
 
18
  # Wait for cloning to complete
19
  time.sleep(10)
20
 
21
+ import subprocess
22
+ import os
23
+ import time
24
+
25
+ # Install required packages
26
+ subprocess.call(["pip", "install", "flet==0.19.0"])
27
+ subprocess.call(["pip", "install", "flet_fastapi==0.19.0"])
28
+
29
+ # Get GitHub token from environment variable
30
+ gh_token = os.getenv("gh_token")
31
+
32
+ # Construct GitHub URL with token for cloning
33
+ url_with_token = f"https://{gh_token}@github.com/Eslam-Magdy-1297/ESearch_FletV01.git"
34
+
35
+ # Clone the repository
36
+ os.system(f"git clone {url_with_token}")
37
+
38
+ # Wait for cloning to complete
39
+ time.sleep(10)
40
+
41
+ # Read and execute main.py code directly
42
+ with open("ESearch_FletV01/main.py", "r") as file:
43
+ code = file.read()
44
+ exec(code)
45