def authenticate(): try: up42.authenticate(project_id=project_id, project_api_key=project_apikey) #up42.authenticate(cfg_file="config.json", env="dev") return None except ValueError as e: return e
def auth(env, project_id, project_api_key): # pylint: disable=unused-variable api = up42.authenticate( project_id=project_id.value, project_api_key=project_api_key.value, env=env, ) self.catalog = up42.initialize_catalog()
def test_global_auth_initialize_objects(): up42.authenticate( project_id=PROJECT_ID, project_api_key=PROJECT_APIKEY, authenticate=False, get_info=False, retry=False, ) project = up42.initialize_project() assert isinstance(project, up42.Project) catalog = up42.initialize_catalog() assert isinstance(catalog, up42.Catalog) workflow = up42.initialize_workflow(workflow_id=WORKFLOW_ID) assert isinstance(workflow, up42.Workflow) job = up42.initialize_job(job_id=JOB_ID) assert isinstance(job, up42.Job) jobtask = up42.initialize_jobtask(job_id=JOB_ID, jobtask_id=JOBTASK_ID) assert isinstance(jobtask, up42.JobTask)
def test_global_auth_initialize_objects(): up42.authenticate( project_id="1234", project_api_key="1234", authenticate=False, get_info=False, retry=False, ) project = up42.initialize_project() assert isinstance(project, up42.Project) catalog = up42.initialize_catalog() assert isinstance(catalog, up42.Catalog) workflow = up42.initialize_workflow(workflow_id="1234") assert isinstance(workflow, up42.Workflow) job = up42.initialize_job(job_id="1234") assert isinstance(job, up42.Job) jobtask = up42.initialize_jobtask(job_id="1234", jobtask_id="1234") assert isinstance(jobtask, up42.JobTask)
def test_global_auth_initialize_objects( auth_mock, project_mock, workflow_mock, job_mock, jobtask_mock, jobcollection_single_mock, storage_mock, order_mock, asset_mock, ): up42.authenticate( project_id=PROJECT_ID, project_api_key=PROJECT_APIKEY, authenticate=True, get_info=False, retry=False, ) project = up42.initialize_project() assert isinstance(project, up42.Project) catalog = up42.initialize_catalog() assert isinstance(catalog, up42.Catalog) workflow = up42.initialize_workflow(workflow_id=WORKFLOW_ID) assert isinstance(workflow, up42.Workflow) job = up42.initialize_job(job_id=JOB_ID) assert isinstance(job, up42.Job) jobtask = up42.initialize_jobtask(job_id=JOB_ID, jobtask_id=JOBTASK_ID) assert isinstance(jobtask, up42.JobTask) jobcollection = up42.initialize_jobcollection(job_ids=[JOB_ID, JOB_ID]) assert isinstance(jobcollection, up42.JobCollection) storage = up42.initialize_storage() assert isinstance(storage, up42.Storage) order = up42.initialize_order(order_id=ORDER_ID) assert isinstance(order, up42.Order) asset = up42.initialize_asset(asset_id=ASSET_ID) assert isinstance(asset, up42.Asset)
import os from pathlib import Path import up42 if __name__ == "__main__": # 30 seconds example with slight changes and production. up42.authenticate( project_id=os.getenv("TEST_UP42_PROJECT_ID"), project_api_key=os.getenv("TEST_UP42_PROJECT_API_KEY"), ) project = up42.initialize_project() workflow = project.create_workflow(name="up42-py-test", use_existing=True) input_tasks = [ "3a381e6b-acb7-4cec-ae65-50798ce80e64", "e374ea64-dc3b-4500-bb4b-974260fb203e", ] workflow.add_workflow_tasks(input_tasks=input_tasks) aoi = workflow.get_example_aoi(location="Berlin") input_parameters = workflow.construct_parameters(geometry=aoi, geometry_operation="bbox", limit=1) job = workflow.run_job(input_parameters=input_parameters) job.track_status() results_fp = job.download_results(output_directory="/tmp") for fp in results_fp: assert Path(fp).exists()