|
31 | 31 | from urllib3.exceptions import (ConnectTimeoutError,
|
32 | 32 | MaxRetryError,
|
33 | 33 | ReadTimeoutError)
|
| 34 | +from warnings import warn |
34 | 35 | from . import _utils, __version__
|
35 | 36 | from ._models import CdxRecord, Memento
|
36 | 37 | from .exceptions import (WaybackException,
|
@@ -369,7 +370,9 @@ def close(self):
|
369 | 370 | def search(self, url, *, match_type=None, limit=1000, offset=None,
|
370 | 371 | fast_latest=None, from_date=None, to_date=None,
|
371 | 372 | filter_field=None, collapse=None, resolve_revisits=True,
|
372 |
| - skip_malformed_results=True): |
| 373 | + skip_malformed_results=True, |
| 374 | + # Deprecated Parameters |
| 375 | + matchType=None, fastLatest=None, resolveRevisits=None): |
373 | 376 | """
|
374 | 377 | Search archive.org's CDX API for all captures of a given URL. This
|
375 | 378 | returns an iterator of :class:`CdxRecord` objects. The `StopIteration`
|
@@ -510,6 +513,27 @@ def search(self, url, *, match_type=None, limit=1000, offset=None,
|
510 | 513 | pagination because they work differently from the `resumeKey` method
|
511 | 514 | this uses, and results do not include recent captures when using them.
|
512 | 515 | """
|
| 516 | + if matchType is not None: |
| 517 | + warn('The `matchType` parameter for search() was renamed to ' |
| 518 | + '`match_type`. Support for the old name will be removed in ' |
| 519 | + 'wayback v0.5.0; please update your code.', |
| 520 | + DeprecationWarning, |
| 521 | + stacklevel=2) |
| 522 | + match_type = match_type or matchType |
| 523 | + if fastLatest is not None: |
| 524 | + warn('The `fastLatest` parameter for search() was renamed to ' |
| 525 | + '`fast_latest`. Support for the old name will be removed in ' |
| 526 | + 'wayback v0.5.0; please update your code.', |
| 527 | + DeprecationWarning, |
| 528 | + stacklevel=2) |
| 529 | + fast_latest = fast_latest or fastLatest |
| 530 | + if resolveRevisits is not None: |
| 531 | + warn('The `resolveRevisits` parameter for search() was renamed to ' |
| 532 | + '`resolve_revisits`. Support for the old name will be removed ' |
| 533 | + 'in wayback v0.5.0; please update your code.', |
| 534 | + DeprecationWarning, |
| 535 | + stacklevel=2) |
| 536 | + resolve_revisits = resolve_revisits or resolveRevisits |
513 | 537 |
|
514 | 538 | # TODO: support args that can be set multiple times: filter, collapse
|
515 | 539 | # Should take input as a sequence and convert to repeat query args
|
@@ -619,7 +643,9 @@ def search(self, url, *, match_type=None, limit=1000, offset=None,
|
619 | 643 |
|
620 | 644 | def get_memento(self, url, timestamp=None, mode=Mode.original, *,
|
621 | 645 | exact=True, exact_redirects=None,
|
622 |
| - target_window=24 * 60 * 60, follow_redirects=True): |
| 646 | + target_window=24 * 60 * 60, follow_redirects=True, |
| 647 | + # Deprecated Parameters |
| 648 | + datetime=None): |
623 | 649 | """
|
624 | 650 | Fetch a memento (an archived HTTP response) from the Wayback Machine.
|
625 | 651 |
|
@@ -690,6 +716,14 @@ def get_memento(self, url, timestamp=None, mode=Mode.original, *,
|
690 | 716 | A :class:`Memento` object with information about the archived HTTP
|
691 | 717 | response.
|
692 | 718 | """
|
| 719 | + if datetime: |
| 720 | + warn('The `datetime` parameter for get_memento() was renamed to ' |
| 721 | + '`timestamp`. Support for the old name will be removed ' |
| 722 | + 'in wayback v0.5.0; please update your code.', |
| 723 | + DeprecationWarning, |
| 724 | + stacklevel=2) |
| 725 | + timestamp = timestamp or datetime |
| 726 | + |
693 | 727 | if exact_redirects is None:
|
694 | 728 | exact_redirects = exact
|
695 | 729 |
|
|
0 commit comments