deriva 1.7.5__tar.gz → 1.7.6__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {deriva-1.7.5/deriva.egg-info → deriva-1.7.6}/PKG-INFO +1 -1
- {deriva-1.7.5 → deriva-1.7.6}/deriva/core/__init__.py +1 -1
- {deriva-1.7.5 → deriva-1.7.6}/deriva/transfer/__init__.py +1 -0
- deriva-1.7.6/deriva/transfer/download/deriva_export.py +241 -0
- {deriva-1.7.5 → deriva-1.7.6/deriva.egg-info}/PKG-INFO +1 -1
- {deriva-1.7.5 → deriva-1.7.6}/deriva.egg-info/SOURCES.txt +1 -0
- {deriva-1.7.5 → deriva-1.7.6}/deriva.egg-info/entry_points.txt +1 -0
- {deriva-1.7.5 → deriva-1.7.6}/setup.py +1 -0
- {deriva-1.7.5 → deriva-1.7.6}/.gitignore +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/CHANGELOG.md +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/LICENSE +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/README.md +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/deriva/__init__.py +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/deriva/config/__init__.py +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/deriva/config/acl_config.py +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/deriva/config/annotation_config.py +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/deriva/config/annotation_validate.py +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/deriva/config/base_config.py +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/deriva/config/dump_catalog_annotations.py +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/deriva/config/examples/group_owner_policy.json +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/deriva/config/examples/self_serve_policy.json +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/deriva/config/rollback_annotation.py +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/deriva/core/annotation.py +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/deriva/core/base_cli.py +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/deriva/core/catalog_cli.py +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/deriva/core/datapath.py +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/deriva/core/deriva_binding.py +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/deriva/core/deriva_server.py +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/deriva/core/ermrest_catalog.py +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/deriva/core/ermrest_model.py +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/deriva/core/hatrac_cli.py +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/deriva/core/hatrac_store.py +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/deriva/core/mmo.py +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/deriva/core/polling_ermrest_catalog.py +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/deriva/core/schemas/app_links.schema.json +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/deriva/core/schemas/asset.schema.json +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/deriva/core/schemas/bulk_upload.schema.json +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/deriva/core/schemas/chaise_config.schema.json +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/deriva/core/schemas/citation.schema.json +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/deriva/core/schemas/column_display.schema.json +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/deriva/core/schemas/display.schema.json +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/deriva/core/schemas/export.schema.json +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/deriva/core/schemas/export_2019.schema.json +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/deriva/core/schemas/foreign_key.schema.json +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/deriva/core/schemas/generated.schema.json +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/deriva/core/schemas/immutable.schema.json +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/deriva/core/schemas/indexing_preferences.schema.json +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/deriva/core/schemas/key_display.schema.json +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/deriva/core/schemas/non_deletable.schema.json +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/deriva/core/schemas/required.schema.json +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/deriva/core/schemas/source_definitions.schema.json +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/deriva/core/schemas/table_alternatives.schema.json +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/deriva/core/schemas/table_display.schema.json +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/deriva/core/schemas/visible_columns.schema.json +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/deriva/core/schemas/visible_foreign_keys.schema.json +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/deriva/core/tests/__init__.py +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/deriva/core/utils/__init__.py +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/deriva/core/utils/core_utils.py +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/deriva/core/utils/globus_auth_utils.py +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/deriva/core/utils/hash_utils.py +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/deriva/core/utils/mime_utils.py +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/deriva/core/utils/version_utils.py +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/deriva/core/utils/webauthn_utils.py +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/deriva/seo/README.md +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/deriva/seo/__init__.py +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/deriva/seo/sitemap_builder.py +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/deriva/seo/sitemap_cli.py +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/deriva/transfer/backup/__init__.py +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/deriva/transfer/backup/__main__.py +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/deriva/transfer/backup/deriva_backup.py +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/deriva/transfer/backup/deriva_backup_cli.py +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/deriva/transfer/download/__init__.py +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/deriva/transfer/download/__main__.py +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/deriva/transfer/download/deriva_download.py +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/deriva/transfer/download/deriva_download_cli.py +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/deriva/transfer/download/processors/__init__.py +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/deriva/transfer/download/processors/base_processor.py +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/deriva/transfer/download/processors/postprocess/__init__.py +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/deriva/transfer/download/processors/postprocess/identifier_post_processor.py +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/deriva/transfer/download/processors/postprocess/transfer_post_processor.py +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/deriva/transfer/download/processors/postprocess/url_post_processor.py +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/deriva/transfer/download/processors/query/__init__.py +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/deriva/transfer/download/processors/query/bag_fetch_query_processor.py +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/deriva/transfer/download/processors/query/base_query_processor.py +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/deriva/transfer/download/processors/query/file_download_query_processor.py +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/deriva/transfer/download/processors/transform/__init__.py +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/deriva/transfer/download/processors/transform/base_transform_processor.py +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/deriva/transfer/download/processors/transform/column_transform_processor.py +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/deriva/transfer/download/processors/transform/fasta_transform_processor.py +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/deriva/transfer/download/processors/transform/format_transform_processor.py +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/deriva/transfer/download/processors/transform/geo_transform_processor.py +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/deriva/transfer/download/processors/transform/string_transform_processor.py +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/deriva/transfer/download/tests/__init__.py +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/deriva/transfer/download/tests/test1.json +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/deriva/transfer/download/tests/test10.json +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/deriva/transfer/download/tests/test11.json +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/deriva/transfer/download/tests/test12.json +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/deriva/transfer/download/tests/test13.json +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/deriva/transfer/download/tests/test14.json +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/deriva/transfer/download/tests/test15.json +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/deriva/transfer/download/tests/test16.json +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/deriva/transfer/download/tests/test19.json +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/deriva/transfer/download/tests/test2.json +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/deriva/transfer/download/tests/test20.json +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/deriva/transfer/download/tests/test3.json +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/deriva/transfer/download/tests/test4.json +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/deriva/transfer/download/tests/test5.json +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/deriva/transfer/download/tests/test6.json +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/deriva/transfer/download/tests/test7.json +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/deriva/transfer/download/tests/test8.json +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/deriva/transfer/download/tests/test9.json +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/deriva/transfer/restore/__init__.py +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/deriva/transfer/restore/__main__.py +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/deriva/transfer/restore/deriva_restore.py +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/deriva/transfer/restore/deriva_restore_cli.py +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/deriva/transfer/upload/__init__.py +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/deriva/transfer/upload/__main__.py +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/deriva/transfer/upload/deriva_upload.py +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/deriva/transfer/upload/deriva_upload_cli.py +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/deriva/transfer/upload/processors/__init__.py +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/deriva/transfer/upload/processors/archive_processor.py +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/deriva/transfer/upload/processors/base_processor.py +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/deriva/transfer/upload/processors/logging_processor.py +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/deriva/transfer/upload/processors/metadata_update_processor.py +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/deriva/transfer/upload/processors/rename_processor.py +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/deriva/transfer/upload/tests/__init__.py +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/deriva/utils/__init__.py +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/deriva.egg-info/dependency_links.txt +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/deriva.egg-info/requires.txt +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/deriva.egg-info/top_level.txt +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/docs/BUILD.md +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/docs/Makefile +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/docs/README.md +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/docs/_static/README.txt +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/docs/api/deriva.config.rst +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/docs/api/deriva.core.rst +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/docs/api/deriva.core.utils.rst +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/docs/api/deriva.rst +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/docs/api/deriva.seo.rst +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/docs/api/deriva.transfer.backup.rst +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/docs/api/deriva.transfer.download.processors.postprocess.rst +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/docs/api/deriva.transfer.download.processors.query.rst +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/docs/api/deriva.transfer.download.processors.rst +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/docs/api/deriva.transfer.download.processors.transform.rst +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/docs/api/deriva.transfer.download.rst +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/docs/api/deriva.transfer.restore.rst +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/docs/api/deriva.transfer.rst +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/docs/api/deriva.transfer.upload.rst +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/docs/cli/commands.md +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/docs/cli/deriva-acl-config.md +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/docs/cli/deriva-annotation-config.md +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/docs/cli/deriva-annotation-validate.md +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/docs/cli/deriva-backup-cli.md +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/docs/cli/deriva-download-cli.md +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/docs/cli/deriva-hatrac-cli.md +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/docs/cli/deriva-restore-cli.md +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/docs/cli/deriva-sitemap-cli.md +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/docs/conf.py +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/docs/derivapy-catalog-snapshot.ipynb +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/docs/derivapy-catalog.ipynb +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/docs/derivapy-datapath-example-1.ipynb +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/docs/derivapy-datapath-example-2.ipynb +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/docs/derivapy-datapath-example-3.ipynb +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/docs/derivapy-datapath-example-4.ipynb +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/docs/derivapy-datapath-update.ipynb +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/docs/get-started.ipynb +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/docs/index.rst +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/docs/install.md +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/docs/make.bat +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/docs/project-tutorial.md +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/docs/using-r.md +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/requirements_dev.txt +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/setup.cfg +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/tests/__init__.py +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/tests/deriva/__init__.py +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/tests/deriva/core/__init__.py +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/tests/deriva/core/mmo/__init__.py +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/tests/deriva/core/mmo/base.py +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/tests/deriva/core/mmo/test_mmo_drop.py +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/tests/deriva/core/mmo/test_mmo_find.py +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/tests/deriva/core/mmo/test_mmo_prune.py +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/tests/deriva/core/mmo/test_mmo_rename.py +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/tests/deriva/core/mmo/test_mmo_replace.py +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/tests/deriva/core/test_datapath.py +0 -0
- {deriva-1.7.5 → deriva-1.7.6}/tests/deriva/core/test_ermrest_model.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: deriva
|
|
3
|
-
Version: 1.7.
|
|
3
|
+
Version: 1.7.6
|
|
4
4
|
Summary: Python APIs and CLIs (Command-Line Interfaces) for the DERIVA platform.
|
|
5
5
|
Home-page: https://github.com/informatics-isi-edu/deriva-py
|
|
6
6
|
Author: USC Information Sciences Institute, Informatics Systems Research Division
|
|
@@ -2,6 +2,7 @@ from deriva.transfer.download.deriva_download import DerivaDownload, GenericDown
|
|
|
2
2
|
DerivaDownloadConfigurationError, DerivaDownloadAuthenticationError, DerivaDownloadAuthorizationError, \
|
|
3
3
|
DerivaDownloadBaggingError
|
|
4
4
|
from deriva.transfer.download.deriva_download_cli import DerivaDownloadCLI
|
|
5
|
+
from deriva.transfer.download.deriva_export import DerivaExport, DerivaExportCLI
|
|
5
6
|
|
|
6
7
|
from deriva.transfer.upload.deriva_upload import DerivaUpload, GenericUploader, DerivaUploadError, DerivaUploadError, \
|
|
7
8
|
DerivaUploadConfigurationError, DerivaUploadCatalogCreateError, DerivaUploadCatalogUpdateError, \
|
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import sys
|
|
3
|
+
import json
|
|
4
|
+
import traceback
|
|
5
|
+
import requests
|
|
6
|
+
import argparse
|
|
7
|
+
import logging
|
|
8
|
+
import certifi
|
|
9
|
+
import datetime
|
|
10
|
+
from collections.abc import Mapping, Iterable
|
|
11
|
+
from requests.exceptions import HTTPError, ConnectionError, Timeout
|
|
12
|
+
from deriva.core.deriva_binding import DerivaClientContext
|
|
13
|
+
from deriva.core.utils.mime_utils import parse_content_disposition
|
|
14
|
+
from deriva.core import BaseCLI, KeyValuePairArgs, get_new_requests_session, get_transfer_summary, get_credential, \
|
|
15
|
+
format_credential, format_exception, urlsplit, DEFAULT_SESSION_CONFIG, DEFAULT_CHUNK_SIZE
|
|
16
|
+
from deriva.transfer.download import DerivaDownloadError, DerivaDownloadConfigurationError, \
|
|
17
|
+
DerivaDownloadAuthenticationError, DerivaDownloadAuthorizationError, DerivaDownloadTimeoutError
|
|
18
|
+
|
|
19
|
+
logger = logging.getLogger(__name__)
|
|
20
|
+
|
|
21
|
+
EXPORT_SERVICE_PATH = "/deriva/export/%s"
|
|
22
|
+
|
|
23
|
+
"""
|
|
24
|
+
Client tool for interacting with DERIVA Export service.
|
|
25
|
+
|
|
26
|
+
:param host (str): The host server for the export operation.
|
|
27
|
+
:param config_file (str): Path to an export configuration file.
|
|
28
|
+
:param credential (dict): Authentication credential (returned from get_credential()) for the export process. Optional.
|
|
29
|
+
:param envars (dict): A dictionary of variables used for template substitution. Optional.
|
|
30
|
+
:param output_dir (str): The directory where exported data will be stored (default: "."). Optional.
|
|
31
|
+
:param defer_download (bool): Whether to defer the actual data download. Optional.
|
|
32
|
+
:param timeout (int): Timeout value for export operations. Optional.
|
|
33
|
+
:param export_type (str): The type of export to perform (default: "bdbag"). Optional.
|
|
34
|
+
|
|
35
|
+
:return: The full path to the downloaded file. If "defer_download" is True, the URL(s) where the export can be downloaded.
|
|
36
|
+
"""
|
|
37
|
+
class DerivaExport:
|
|
38
|
+
def __init__(self, **kwargs):
|
|
39
|
+
self.host = kwargs.get("host")
|
|
40
|
+
self.config_file = kwargs.get("config_file")
|
|
41
|
+
self.envars = kwargs.get("envars", dict())
|
|
42
|
+
self.credential = kwargs.get("credential")
|
|
43
|
+
self.output_dir = kwargs.get("output_dir", ".")
|
|
44
|
+
self.defer_download = kwargs.get("defer_download")
|
|
45
|
+
self.timeout = kwargs.get("timeout")
|
|
46
|
+
self.export_type = kwargs.get("export_type", "bdbag")
|
|
47
|
+
self.base_server_uri = "https://" + self.host
|
|
48
|
+
self.service_url = self.base_server_uri + EXPORT_SERVICE_PATH % self.export_type
|
|
49
|
+
self.session_config = DEFAULT_SESSION_CONFIG.copy()
|
|
50
|
+
if self.timeout is not None:
|
|
51
|
+
self.session_config["timeout"] = self.timeout
|
|
52
|
+
self.session = get_new_requests_session(self.service_url, self.session_config)
|
|
53
|
+
self.dcctx = DerivaClientContext()
|
|
54
|
+
self.session.headers.update({'deriva-client-context': self.dcctx.encoded()})
|
|
55
|
+
|
|
56
|
+
# credential initialization
|
|
57
|
+
if self.credential is None:
|
|
58
|
+
token = kwargs.get("token")
|
|
59
|
+
oauth2_token = kwargs.get("oauth2_token")
|
|
60
|
+
credential_file = kwargs.get("credential_file")
|
|
61
|
+
if token or oauth2_token:
|
|
62
|
+
self.credential = format_credential(token=token, oauth2_token=oauth2_token)
|
|
63
|
+
else:
|
|
64
|
+
self.credential = get_credential(self.host, credential_file)
|
|
65
|
+
|
|
66
|
+
if self.credential is None:
|
|
67
|
+
raise DerivaDownloadAuthenticationError(
|
|
68
|
+
"The requested service requires authentication and a valid login credential could "
|
|
69
|
+
"not be found (or was not provided) for the specified host.")
|
|
70
|
+
if 'bearer-token' in self.credential:
|
|
71
|
+
self.session.headers.update(
|
|
72
|
+
{'Authorization': 'Bearer {token}'.format(token=self.credential['bearer-token'])})
|
|
73
|
+
elif 'cookie' in self.credential:
|
|
74
|
+
cname, cval = self.credential['cookie'].split('=', 1)
|
|
75
|
+
self.session.cookies.set(cname, cval, domain=self.host, path='/')
|
|
76
|
+
|
|
77
|
+
def validate_authn_session(self):
|
|
78
|
+
url = self.base_server_uri + "/authn/session"
|
|
79
|
+
r = self.session.get(url)
|
|
80
|
+
if r.status_code == requests.codes.not_found or r.status_code == requests.codes.unauthorized:
|
|
81
|
+
logger.warning("Unable to authenticate. Check for missing or expired credentials.")
|
|
82
|
+
r.raise_for_status()
|
|
83
|
+
return r.json()
|
|
84
|
+
|
|
85
|
+
def recursive_format(self, d, **kwargs):
|
|
86
|
+
"""
|
|
87
|
+
Recursively apply str.format to all string-based values in a dictionary.
|
|
88
|
+
Supports nested dictionaries and lists.
|
|
89
|
+
|
|
90
|
+
:param d: Dictionary or iterable containing values to be formatted
|
|
91
|
+
:param kwargs: Formatting arguments
|
|
92
|
+
:return: New dictionary or iterable with formatted strings
|
|
93
|
+
"""
|
|
94
|
+
if isinstance(d, Mapping):
|
|
95
|
+
return {k: self.recursive_format(v, **kwargs) for k, v in d.items()}
|
|
96
|
+
elif isinstance(d, str):
|
|
97
|
+
return d.format(**kwargs)
|
|
98
|
+
elif isinstance(d, Iterable) and not isinstance(d, (str, bytes)):
|
|
99
|
+
return type(d)(self.recursive_format(v, **kwargs) for v in d)
|
|
100
|
+
else:
|
|
101
|
+
return d
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
def retrieve_file(self, url):
|
|
105
|
+
content_disposition = None
|
|
106
|
+
try:
|
|
107
|
+
head = self.session.head(url)
|
|
108
|
+
if head.ok:
|
|
109
|
+
content_disposition = head.headers.get("Content-Disposition") if head.ok else None
|
|
110
|
+
if not content_disposition:
|
|
111
|
+
raise DerivaDownloadError("HEAD response missing Content-Disposition header.")
|
|
112
|
+
except requests.HTTPError as e:
|
|
113
|
+
raise DerivaDownloadError("HEAD request for [%s] failed: %s" % (url, e))
|
|
114
|
+
|
|
115
|
+
filename = parse_content_disposition(content_disposition)
|
|
116
|
+
output_path = os.path.abspath(os.path.join(self.output_dir, filename))
|
|
117
|
+
with self.session.get(url, stream=True, verify=certifi.where()) as r:
|
|
118
|
+
if r.status_code != 200:
|
|
119
|
+
file_error = "File [%s] transfer failed." % output_path
|
|
120
|
+
url_error = 'HTTP GET Failed for url: %s' % url
|
|
121
|
+
host_error = "Host %s responded:\n\n%s" % (urlsplit(url).netloc, r.text)
|
|
122
|
+
raise DerivaDownloadError('%s\n\n%s\n%s' % (file_error, url_error, host_error))
|
|
123
|
+
else:
|
|
124
|
+
total = 0
|
|
125
|
+
start = datetime.datetime.now()
|
|
126
|
+
logging.debug("Transferring file %s to %s" % (url, output_path))
|
|
127
|
+
with open(output_path, 'wb') as data_file:
|
|
128
|
+
for chunk in r.iter_content(chunk_size=DEFAULT_CHUNK_SIZE):
|
|
129
|
+
data_file.write(chunk)
|
|
130
|
+
total += len(chunk)
|
|
131
|
+
elapsed = datetime.datetime.now() - start
|
|
132
|
+
summary = get_transfer_summary(total, elapsed)
|
|
133
|
+
logging.info("File [%s] transfer successful. %s" % (output_path, summary))
|
|
134
|
+
return output_path
|
|
135
|
+
|
|
136
|
+
def export(self):
|
|
137
|
+
try:
|
|
138
|
+
auth = self.validate_authn_session()
|
|
139
|
+
logger.debug("Authenticated session established. Session attributes: %s" % auth)
|
|
140
|
+
|
|
141
|
+
try:
|
|
142
|
+
logger.info("Processing export config file: %s" % self.config_file)
|
|
143
|
+
with open(self.config_file, encoding='utf-8') as cf:
|
|
144
|
+
config = json.loads(cf.read())
|
|
145
|
+
env = config.get("env", {})
|
|
146
|
+
env = self.recursive_format(env, **self.envars)
|
|
147
|
+
config.update({"env": env})
|
|
148
|
+
except Exception as e:
|
|
149
|
+
raise DerivaDownloadConfigurationError("Error processing export config file: %s" % format_exception(e))
|
|
150
|
+
|
|
151
|
+
logger.info("Requesting %s export at: %s" % (self.export_type, self.service_url))
|
|
152
|
+
response = self.session.post(self.service_url, json=config)
|
|
153
|
+
response.raise_for_status()
|
|
154
|
+
result_urls = response.text.split('\n')
|
|
155
|
+
logger.info("Export successful. Service responded with URL list: %s" % result_urls)
|
|
156
|
+
if not self.defer_download:
|
|
157
|
+
if self.export_type == "bdbag":
|
|
158
|
+
result_url = result_urls[1] if len(result_urls) > 1 else result_urls[0]
|
|
159
|
+
logger.info("Downloading exported bag content from %s to directory: %s" %
|
|
160
|
+
(result_url, os.path.abspath(self.output_dir)))
|
|
161
|
+
return self.retrieve_file(result_url)
|
|
162
|
+
elif self.export_type == "file":
|
|
163
|
+
for result_url in result_urls:
|
|
164
|
+
self.retrieve_file(result_url)
|
|
165
|
+
logger.info("Downloading exported file content from %s to directory: %s" %
|
|
166
|
+
(result_url, os.path.abspath(self.output_dir)))
|
|
167
|
+
else:
|
|
168
|
+
pass
|
|
169
|
+
else:
|
|
170
|
+
return result_urls
|
|
171
|
+
except ConnectionError as e:
|
|
172
|
+
raise DerivaDownloadError("Connection error occurred. %s" % format_exception(e))
|
|
173
|
+
except Timeout as e:
|
|
174
|
+
raise DerivaDownloadTimeoutError("Connection timeout occurred. %s" % format_exception(e))
|
|
175
|
+
except HTTPError as e:
|
|
176
|
+
if e.response.status_code == requests.codes.unauthorized:
|
|
177
|
+
raise DerivaDownloadAuthenticationError(
|
|
178
|
+
"The requested service requires authentication and a valid login session could "
|
|
179
|
+
"not be found for the specified host. Server responded: %s" % format_exception(e))
|
|
180
|
+
elif e.response.status_code == requests.codes.forbidden:
|
|
181
|
+
raise DerivaDownloadAuthorizationError(
|
|
182
|
+
"A requested operation was forbidden. Server responded: %s" % format_exception(e))
|
|
183
|
+
else:
|
|
184
|
+
raise DerivaDownloadError(format_exception(e))
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
class DerivaExportCLI(BaseCLI):
|
|
188
|
+
def __init__(self, description, epilog, **kwargs):
|
|
189
|
+
|
|
190
|
+
BaseCLI.__init__(self, description, epilog, **kwargs)
|
|
191
|
+
self.parser.add_argument("--defer-download", action="store_true",
|
|
192
|
+
help="Do not download exported file(s). Default: False")
|
|
193
|
+
self.parser.add_argument("--timeout", metavar="<seconds>",
|
|
194
|
+
help="Total number of seconds elapsed before the download is aborted.")
|
|
195
|
+
self.parser.add_argument("--export-type", choices=["bdbag", "file"], default="bdbag",
|
|
196
|
+
help="Export type: {bdbag|file}. Default is bdbag.",)
|
|
197
|
+
self.parser.add_argument("--output-dir", metavar="<output dir>", default=".",
|
|
198
|
+
help="Path to an output directory. Default is current directory.")
|
|
199
|
+
self.parser.add_argument("envars", metavar="[key=value key=value ...]",
|
|
200
|
+
nargs=argparse.REMAINDER, action=KeyValuePairArgs, default={},
|
|
201
|
+
help="Variable length of whitespace-delimited key=value pair arguments used for "
|
|
202
|
+
"string interpolation in specific parts of the configuration file. "
|
|
203
|
+
"For example: key1=value1 key2=value2")
|
|
204
|
+
|
|
205
|
+
def main(self):
|
|
206
|
+
try:
|
|
207
|
+
args = self.parse_cli()
|
|
208
|
+
except ValueError as e:
|
|
209
|
+
sys.stderr.write(str(e))
|
|
210
|
+
return 2
|
|
211
|
+
if not args.quiet:
|
|
212
|
+
sys.stderr.write("\n")
|
|
213
|
+
|
|
214
|
+
try:
|
|
215
|
+
exporter = DerivaExport(**vars(args))
|
|
216
|
+
exporter.export()
|
|
217
|
+
except (DerivaDownloadError, DerivaDownloadConfigurationError, DerivaDownloadAuthenticationError,
|
|
218
|
+
DerivaDownloadAuthorizationError, DerivaDownloadTimeoutError) as e:
|
|
219
|
+
sys.stderr.write(("\n" if not args.quiet else "") + format_exception(e))
|
|
220
|
+
if args.debug:
|
|
221
|
+
traceback.print_exc()
|
|
222
|
+
return 1
|
|
223
|
+
except:
|
|
224
|
+
sys.stderr.write("An unexpected error occurred.")
|
|
225
|
+
traceback.print_exc()
|
|
226
|
+
return 1
|
|
227
|
+
finally:
|
|
228
|
+
if not args.quiet:
|
|
229
|
+
sys.stderr.write("\n\n")
|
|
230
|
+
return 0
|
|
231
|
+
|
|
232
|
+
DESC = "Deriva Export Service Download Utility - CLI"
|
|
233
|
+
INFO = "For more information see: https://github.com/informatics-isi-edu/deriva-py"
|
|
234
|
+
|
|
235
|
+
def main():
|
|
236
|
+
cli = DerivaExportCLI(DESC, INFO, hostname_required=True, config_file_required=True)
|
|
237
|
+
return cli.main()
|
|
238
|
+
|
|
239
|
+
|
|
240
|
+
if __name__ == '__main__':
|
|
241
|
+
sys.exit(main())
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: deriva
|
|
3
|
-
Version: 1.7.
|
|
3
|
+
Version: 1.7.6
|
|
4
4
|
Summary: Python APIs and CLIs (Command-Line Interfaces) for the DERIVA platform.
|
|
5
5
|
Home-page: https://github.com/informatics-isi-edu/deriva-py
|
|
6
6
|
Author: USC Information Sciences Institute, Informatics Systems Research Division
|
|
@@ -76,6 +76,7 @@ deriva/transfer/download/__init__.py
|
|
|
76
76
|
deriva/transfer/download/__main__.py
|
|
77
77
|
deriva/transfer/download/deriva_download.py
|
|
78
78
|
deriva/transfer/download/deriva_download_cli.py
|
|
79
|
+
deriva/transfer/download/deriva_export.py
|
|
79
80
|
deriva/transfer/download/processors/__init__.py
|
|
80
81
|
deriva/transfer/download/processors/base_processor.py
|
|
81
82
|
deriva/transfer/download/processors/postprocess/__init__.py
|
|
@@ -7,6 +7,7 @@ deriva-annotation-validate = deriva.config.annotation_validate:main
|
|
|
7
7
|
deriva-backup-cli = deriva.transfer.backup.__main__:main
|
|
8
8
|
deriva-catalog-cli = deriva.core.catalog_cli:main
|
|
9
9
|
deriva-download-cli = deriva.transfer.download.__main__:main
|
|
10
|
+
deriva-export-cli = deriva.transfer.download.deriva_export:main
|
|
10
11
|
deriva-globus-auth-utils = deriva.core.utils.globus_auth_utils:main
|
|
11
12
|
deriva-hatrac-cli = deriva.core.hatrac_cli:main
|
|
12
13
|
deriva-restore-cli = deriva.transfer.restore.__main__:main
|
|
@@ -47,6 +47,7 @@ setup(
|
|
|
47
47
|
'console_scripts': [
|
|
48
48
|
'deriva-upload-cli = deriva.transfer.upload.__main__:main',
|
|
49
49
|
'deriva-download-cli = deriva.transfer.download.__main__:main',
|
|
50
|
+
'deriva-export-cli = deriva.transfer.download.deriva_export:main',
|
|
50
51
|
'deriva-catalog-cli = deriva.core.catalog_cli:main',
|
|
51
52
|
'deriva-hatrac-cli = deriva.core.hatrac_cli:main',
|
|
52
53
|
'deriva-acl-config = deriva.config.acl_config:main',
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{deriva-1.7.5 → deriva-1.7.6}/deriva/transfer/download/processors/postprocess/url_post_processor.py
RENAMED
|
File without changes
|
|
File without changes
|
{deriva-1.7.5 → deriva-1.7.6}/deriva/transfer/download/processors/query/bag_fetch_query_processor.py
RENAMED
|
File without changes
|
{deriva-1.7.5 → deriva-1.7.6}/deriva/transfer/download/processors/query/base_query_processor.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{deriva-1.7.5 → deriva-1.7.6}/deriva/transfer/upload/processors/metadata_update_processor.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|