Преглед на файлове

Fix links validation script (#1426)

pull/1427/head
Sitram преди 4 години
committed by GitHub
родител
ревизия
dc903e6dd2
No known key found for this signature in database GPG ключ ID: 4AEE18F83AFDEB23
променени са 2 файла, в които са добавени 6 реда и са изтрити 4 реда
  1. +3
    -1
      README.md
  2. +3
    -3
      build/validate_links.py

+ 3
- 1
README.md Целия файл

@@ -1,4 +1,6 @@
# Public APIs [![Run tests](https://github.com/public-apis/public-apis/workflows/Run%20tests/badge.svg)](https://github.com/public-apis/public-apis/actions?query=workflow%3A%22Run+tests%22)
# Public APIs [![Run tests](https://github.com/public-apis/public-apis/workflows/Run%20tests/badge.svg)](https://github.com/public-apis/public-apis/actions?query=workflow%3A%22Run+tests%22) [![Validate links](https://github.com/public-apis/public-apis/workflows/Validate%20links/badge.svg?branch=master)](https://github.com/public-apis/public-apis/actions?query=workflow%3A%22Validate+links%22)

![Run tests](https://github.com/public-apis/public-apis/workflows/Run%20tests/badge.svg?branch=master)

A collective list of free APIs for use in software and web development.



+ 3
- 3
build/validate_links.py Целия файл

@@ -22,9 +22,9 @@ def validate_links(links):
print('Validating {} links...'.format(len(links)))
errors = []
for link in links:
h = httplib2.Http(disable_ssl_certificate_validation=True, timeout=10)
h = httplib2.Http(disable_ssl_certificate_validation=True, timeout=25)
try:
resp = h.request(link)
resp = h.request(link, headers={'user-agent': 'Mozilla/5.0'})
code = int(resp[0]['status'])
# check if status code is a client or server error
if code >= 404:
@@ -37,7 +37,7 @@ def validate_links(links):
# Ignore some exceptions which are not actually errors.
# The list below should be extended with other exceptions in the future if needed
if ((-1 != str(e).find("Content purported to be compressed with gzip but failed to decompress.")) and
(-1 != str(e).find("[SSL: CERTIFICATE_VERIFY_FAIL)ED] certificate verify failed (_ssl.c:852)"))) :
(-1 != str(e).find("[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:852)"))) :
errors.append("ERR: {} : {}".format(e, link))
return errors



Зареждане…
Отказ
Запис