-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathregex.py
40 lines (27 loc) · 1.01 KB
/
regex.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import re
import urllib.request as request
import urllib.error as urlerror
from urllib.error import URLError, HTTPError
def checkRepo(url: str) -> str:
try:
webURL = request.urlopen(url)
except:
return "could not open URL"
else:
#print("result for opening repository code: " + str(webURL.getcode()))
data = webURL.read()
#webData = open("web-data.txt", "w+")
#webData.truncate()
#webData.write(str(data))
x = re.findall('data-menu-button>(.*?)<\/span>', str(data))
if len(x) <= 0:
print("len <= 0")
return "Does not exist"
#print("Result of regex: ", x)
#print("------------------------------------", url+'/tree/'+x[0]+'/.github/workflows')
try:
webGAURL = request.urlopen(url+'/tree/'+x[0]+'/.github/workflows')
except:
return "No" # does not have GA
return "Yes"
#print("result for GITHUB ACTIONs CHECK code: " + str(webGAURL.getcode()))