Skip to content

Commit

Permalink
only getting repos that resolve
Browse files Browse the repository at this point in the history
  • Loading branch information
Wamy-Dev committed Jul 25, 2022
1 parent fdddbec commit 7ec3727
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions source/v2/grabber.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
import string
from git import Repo
import os
import shutil

#env variables
CRONMONITORING = config("CRONMONITORING")
#firestore
Expand Down Expand Up @@ -52,12 +54,18 @@ def delete_collection(coll_ref, batch_size):
namelower = name.lower()
description = data["data"][0]["description"]
url = data["data"][0]["uri"]
urltest = requests.get(url, timeout=3)
if urltest.ok:
url = data["data"][0]["uri"]
else:
print(f"### {name} is a bad repo. Skipping ###")
continue
repoicon = f"{url}/CydiaIcon.png"
repoicontest = requests.get(repoicon, timeout=3)
if repoicontest.status_code != 200:
repoicon = "https://github.com/Wamy-Dev/Apokto/blob/main/assets/error.png?raw=true"
else:
if repoicontest.ok:
repoicon = f"{url}/CydiaIcon.png"
else:
repoicon = "https://github.com/Wamy-Dev/Apokto/blob/main/assets/error.png?raw=true"
#now upload to firebase
try:
upload = db.collection("repos").document(name)
Expand All @@ -71,9 +79,9 @@ def delete_collection(coll_ref, batch_size):
}, merge=True)
print(f"### Uploaded {name} to database ###")
except:
print("### Bad repo. Skipping ###")
print(f"### {name} is a bad repo. Skipping ###")
else:
print("### Bad repo. Skipping ###")
print(f"### {name} is a bad repo. Skipping ###")
except:
print("### Bad repo. Skipping ###")
#custom repos
Expand All @@ -91,7 +99,9 @@ def ApoktoCustom(current):
"number": current
}, merge=True)
print("### Uploaded Apokto to database ###")
ApoktoCustom(current)
ApoktoCustom(current)
#delete sources file
shutil.rmtree("./sources")
try:
now=datetime.now()
current_time = now.strftime("%H:%M:%S")
Expand Down

0 comments on commit 7ec3727

Please sign in to comment.