1
0
mirror of https://gitlab.com/fdroid/fdroidserver.git synced 2024-10-02 09:10:11 +02:00

versioned download_repo_index_v1() to be future proof

This commit is contained in:
Hans-Christoph Steiner 2023-03-07 21:44:28 +01:00
parent f7b8a100c7
commit 723873456d
No known key found for this signature in database
GPG Key ID: 3E177817BA1B9BFA
2 changed files with 14 additions and 2 deletions

View File

@ -36,9 +36,11 @@ from fdroidserver.common import (verify_apk_signature,
verify_apk_signature # NOQA: B101
generate_keystore # NOQA: B101
from fdroidserver.index import (download_repo_index,
download_repo_index_v1,
get_mirror_service_urls,
make as make_index) # NOQA: E402
download_repo_index # NOQA: B101
download_repo_index_v1 # NOQA: B101
get_mirror_service_urls # NOQA: B101
make_index # NOQA: B101
from fdroidserver.update import (process_apk,

View File

@ -1476,7 +1476,17 @@ def get_mirror_service_urls(url):
def download_repo_index(url_str, etag=None, verify_fingerprint=True, timeout=600):
"""Download and verifies index file, then returns its data.
"""Download and verifies index v1 file, then returns its data.
Use the versioned functions to be sure you are getting the
expected data format.
"""
return download_repo_index_v1(url_str, etag, verify_fingerprint, timeout)
def download_repo_index_v1(url_str, etag=None, verify_fingerprint=True, timeout=600):
"""Download and verifies index v1 file, then returns its data.
Downloads the repository index from the given :param url_str and
verifies the repository's fingerprint if :param verify_fingerprint
@ -1489,7 +1499,7 @@ def download_repo_index(url_str, etag=None, verify_fingerprint=True, timeout=600
Returns
-------
A tuple consisting of:
- The index in JSON format or None if the index did not change
- The index in JSON v1 format or None if the index did not change
- The new eTag as returned by the HTTP request
"""