Skip to content
Snippets Groups Projects
Verified Commit 203f6db8 authored by Antoine R. Dumont's avatar Antoine R. Dumont
Browse files

packagist: Randomize the packages list

To avoid starting always in the same order the packages list when some problems occur in
previous listing.
parent b4fce7be
No related branches found
No related tags found
1 merge request!496packagist: Make lister more resilient & actually list origins
......@@ -7,6 +7,7 @@ from dataclasses import dataclass
from datetime import datetime, timezone
import logging
from typing import Any, Dict, Iterator, List, Optional
from random import shuffle
import iso8601
import requests
......@@ -123,9 +124,11 @@ class PackagistLister(Lister[PackagistListerState, PackagistPageType]):
def get_pages(self) -> Iterator[PackagistPageType]:
"""
Yield a single page listing all Packagist projects.
Yield a single page listing all Packagist projects (randomly).
"""
yield self.api_request(self.url)["packageNames"]
package_names = self.api_request(self.url)["packageNames"]
shuffle(package_names)
yield package_names
def _get_metadata_from_page(
self, package_url_format: str, package_name: str
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment