mirror of
https://github.com/public-apis/public-apis.git
synced 2025-05-10 15:46:48 +02:00
Update build scripts to pass flake8
This commit is contained in:
parent
e53982f9d1
commit
9eaf189595
5 changed files with 70 additions and 57 deletions
|
@ -10,12 +10,13 @@ def parse_links(filename):
|
|||
"""Returns a list of URLs from text file"""
|
||||
with open(filename) as fp:
|
||||
data = fp.read()
|
||||
raw_links = re.findall( \
|
||||
'http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\(\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+', \
|
||||
data)
|
||||
raw_links = re.findall(
|
||||
'http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\(\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+',
|
||||
data)
|
||||
links = [raw_link.replace(')', '') for raw_link in raw_links]
|
||||
return links
|
||||
|
||||
|
||||
def validate_links(links):
|
||||
"""Checks each entry in JSON file for live link"""
|
||||
print('Validating {} links...'.format(len(links)))
|
||||
|
@ -34,6 +35,7 @@ def validate_links(links):
|
|||
errors.append("SOC: {} : {}".format(socketerror, link))
|
||||
return errors
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
num_args = len(sys.argv)
|
||||
if num_args < 2:
|
||||
|
@ -44,4 +46,3 @@ if __name__ == "__main__":
|
|||
for err in errors:
|
||||
print(err)
|
||||
sys.exit(1)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue