Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(kernel_crawler): avoid failing if archlinux GET fails. #197

Merged
merged 1 commit into from
Apr 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 12 additions & 9 deletions kernel_crawler/archlinux.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import requests
from bs4 import BeautifulSoup
import re

Expand Down Expand Up @@ -44,14 +44,17 @@ def parse_kernel_release(self, kernel_package):
def get_package_tree(self, filter=''):
packages = {}

soup = BeautifulSoup(get_url(self.base_url), features='lxml')
for a in soup.find_all('a', href=True):
package = a['href']
# skip .sig and .. links
if not package.endswith('.sig') and package != '../':
parsed_kernel_release = self.parse_kernel_release(package)

packages.setdefault(parsed_kernel_release, set()).add(self.base_url + package)
try:
soup = BeautifulSoup(get_url(self.base_url), features='lxml')
for a in soup.find_all('a', href=True):
package = a['href']
# skip .sig and .. links
if not package.endswith('.sig') and package != '../':
parsed_kernel_release = self.parse_kernel_release(package)

packages.setdefault(parsed_kernel_release, set()).add(self.base_url + package)
except requests.HTTPError:
pass

return packages

Expand Down
Loading