added cli support for sort, use-pagination and closest
This commit is contained in:
@@ -63,6 +63,9 @@ def handle_cdx(data: List[Any]) -> None:
|
|||||||
limit = data[7]
|
limit = data[7]
|
||||||
gzip = data[8]
|
gzip = data[8]
|
||||||
match_type = data[9]
|
match_type = data[9]
|
||||||
|
sort = data[10]
|
||||||
|
use_pagination = data[11]
|
||||||
|
closest = data[12]
|
||||||
|
|
||||||
filters = list(cdx_filter)
|
filters = list(cdx_filter)
|
||||||
collapses = list(collapse)
|
collapses = list(collapse)
|
||||||
@@ -73,8 +76,11 @@ def handle_cdx(data: List[Any]) -> None:
|
|||||||
user_agent=user_agent,
|
user_agent=user_agent,
|
||||||
start_timestamp=start_timestamp,
|
start_timestamp=start_timestamp,
|
||||||
end_timestamp=end_timestamp,
|
end_timestamp=end_timestamp,
|
||||||
|
closest=closest,
|
||||||
filters=filters,
|
filters=filters,
|
||||||
match_type=match_type,
|
match_type=match_type,
|
||||||
|
sort=sort,
|
||||||
|
use_pagination=use_pagination,
|
||||||
gzip=gzip,
|
gzip=gzip,
|
||||||
collapses=collapses,
|
collapses=collapses,
|
||||||
limit=limit,
|
limit=limit,
|
||||||
@@ -249,7 +255,6 @@ def save_urls_on_file(url_gen: Generator[str, None, None]) -> None:
|
|||||||
help="Use with '--known_urls' to save the URLs in file at current directory.",
|
help="Use with '--known_urls' to save the URLs in file at current directory.",
|
||||||
)
|
)
|
||||||
@click.option(
|
@click.option(
|
||||||
"-c",
|
|
||||||
"--cdx",
|
"--cdx",
|
||||||
default=False,
|
default=False,
|
||||||
is_flag=True,
|
is_flag=True,
|
||||||
@@ -269,6 +274,12 @@ def save_urls_on_file(url_gen: Generator[str, None, None]) -> None:
|
|||||||
"--to",
|
"--to",
|
||||||
help="End timestamp for CDX API in yyyyMMddhhmmss format.",
|
help="End timestamp for CDX API in yyyyMMddhhmmss format.",
|
||||||
)
|
)
|
||||||
|
@click.option(
|
||||||
|
"-C",
|
||||||
|
"--closest",
|
||||||
|
help="Archive that are closest the timestamp passed as arguments to this "
|
||||||
|
+ "parameter.",
|
||||||
|
)
|
||||||
@click.option(
|
@click.option(
|
||||||
"-f",
|
"-f",
|
||||||
"--cdx-filter",
|
"--cdx-filter",
|
||||||
@@ -285,6 +296,20 @@ def save_urls_on_file(url_gen: Generator[str, None, None]) -> None:
|
|||||||
+ "However, the CDX server can also return results matching a certain prefix, "
|
+ "However, the CDX server can also return results matching a certain prefix, "
|
||||||
+ "a certain host, or all sub-hosts by using the match_type",
|
+ "a certain host, or all sub-hosts by using the match_type",
|
||||||
)
|
)
|
||||||
|
@click.option(
|
||||||
|
"-st",
|
||||||
|
"--sort",
|
||||||
|
help="Choose one from default, closest or reverse. It returns sorted CDX entries "
|
||||||
|
+ "in the response.",
|
||||||
|
)
|
||||||
|
@click.option(
|
||||||
|
"-up",
|
||||||
|
"--use-pagination",
|
||||||
|
"--use_pagination",
|
||||||
|
default=False,
|
||||||
|
is_flag=True,
|
||||||
|
help="Use the pagination API of the CDX server instead of the default one.",
|
||||||
|
)
|
||||||
@click.option(
|
@click.option(
|
||||||
"-gz",
|
"-gz",
|
||||||
"--gzip",
|
"--gzip",
|
||||||
@@ -326,6 +351,7 @@ def main( # pylint: disable=no-value-for-parameter
|
|||||||
subdomain: bool,
|
subdomain: bool,
|
||||||
file: bool,
|
file: bool,
|
||||||
cdx: bool,
|
cdx: bool,
|
||||||
|
use_pagination: bool,
|
||||||
cdx_filter: List[str],
|
cdx_filter: List[str],
|
||||||
collapse: List[str],
|
collapse: List[str],
|
||||||
cdx_print: List[str],
|
cdx_print: List[str],
|
||||||
@@ -337,7 +363,9 @@ def main( # pylint: disable=no-value-for-parameter
|
|||||||
minute: Optional[int] = None,
|
minute: Optional[int] = None,
|
||||||
start_timestamp: Optional[str] = None,
|
start_timestamp: Optional[str] = None,
|
||||||
end_timestamp: Optional[str] = None,
|
end_timestamp: Optional[str] = None,
|
||||||
|
closest: Optional[str] = None,
|
||||||
match_type: Optional[str] = None,
|
match_type: Optional[str] = None,
|
||||||
|
sort: Optional[str] = None,
|
||||||
gzip: Optional[str] = None,
|
gzip: Optional[str] = None,
|
||||||
limit: Optional[str] = None,
|
limit: Optional[str] = None,
|
||||||
) -> None:
|
) -> None:
|
||||||
@@ -428,6 +456,9 @@ def main( # pylint: disable=no-value-for-parameter
|
|||||||
limit,
|
limit,
|
||||||
gzip,
|
gzip,
|
||||||
match_type,
|
match_type,
|
||||||
|
sort,
|
||||||
|
use_pagination,
|
||||||
|
closest,
|
||||||
]
|
]
|
||||||
handle_cdx(data)
|
handle_cdx(data)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user