From 52ac5fd4c5cbe27f4ec2a4ec8fefc77f541190a8 Mon Sep 17 00:00:00 2001 From: Ben Blaiszik Date: Mon, 4 Oct 2021 16:55:16 -0500 Subject: [PATCH 01/13] Update README to trigger flow --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 68a6aaf..b4d2e5e 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # MDF Connect Client -[![PyPI](https://img.shields.io/pypi/v/mdf_connect_client.svg)](https://pypi.python.org/pypi/mdf-connect-client) [![Build Status](https://travis-ci.org/materials-data-facility/connect_client.svg?branch=master)](https://travis-ci.org/materials-data-facility/connect_client) [![Coverage Status](https://coveralls.io/repos/github/materials-data-facility/connect_client/badge.svg?branch=master)](https://coveralls.io/github/materials-data-facility/connect_client?branch=master) [![Read the Docs](https://readthedocs.org/projects/mdf-connect-client/badge/?version=master)](http://mdf-connect-client.readthedocs.io/en/master/) +[![PyPI](https://img.shields.io/pypi/v/mdf_connect_client.svg)](https://pypi.python.org/pypi/mdf-connect-client) ![Github Actions Tests](https://github.com/materials-data-facility/connect_client/actions/workflows/testing-work.yml/badge.svg)[![Read the Docs](https://readthedocs.org/projects/mdf-connect-client/badge/?version=master)](http://mdf-connect-client.readthedocs.io/en/master/) The MDF Connect Client is the Python client to easily submit datasets to MDF Connect. From 3ace7ecc5aaf9c80baef2911a26fc5356505b373 Mon Sep 17 00:00:00 2001 From: Ben Blaiszik Date: Mon, 4 Oct 2021 17:02:09 -0500 Subject: [PATCH 02/13] Add requirements.txt file --- requirements.txt | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 requirements.txt diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..c781c0c --- /dev/null +++ b/requirements.txt @@ -0,0 +1,3 @@ +mdf-toolbox>=0.5.0 +nameparser>=1.0.4 +requests>=2.18.4 \ No newline at end of file From 9117ac2a8c6d85350e1c1d066927561217c6f4d2 Mon Sep 17 00:00:00 2001 From: Ben Blaiszik Date: Mon, 4 Oct 2021 17:07:17 -0500 Subject: [PATCH 03/13] Adding jsonschema --- requirements.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index c781c0c..6aacc23 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,4 @@ mdf-toolbox>=0.5.0 nameparser>=1.0.4 -requests>=2.18.4 \ No newline at end of file +requests>=2.18.4 +jsonschema \ No newline at end of file From b44adec65aad89c41d31e90d3256765ef7403b04 Mon Sep 17 00:00:00 2001 From: Ben Blaiszik Date: Mon, 4 Oct 2021 17:09:40 -0500 Subject: [PATCH 04/13] Adding pip install line --- .github/workflows/testing-work.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/testing-work.yml b/.github/workflows/testing-work.yml index d0df644..01cd430 100644 --- a/.github/workflows/testing-work.yml +++ b/.github/workflows/testing-work.yml @@ -32,6 +32,7 @@ jobs: python -m pip install --upgrade pip pip install flake8 pytest pip install pytest-cov + pip install -e . if [ -f requirements.txt ]; then pip install -r requirements.txt; fi - name: Test with pytest From eb29abff496f361d28433aa606340424a8bdd83a Mon Sep 17 00:00:00 2001 From: Ben Blaiszik Date: Mon, 4 Oct 2021 23:33:20 -0500 Subject: [PATCH 05/13] Update testing-work.yml --- .github/workflows/testing-work.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/testing-work.yml b/.github/workflows/testing-work.yml index 01cd430..66530e4 100644 --- a/.github/workflows/testing-work.yml +++ b/.github/workflows/testing-work.yml @@ -33,6 +33,7 @@ jobs: pip install flake8 pytest pip install pytest-cov pip install -e . + pip install -r test_requirements.txt if [ -f requirements.txt ]; then pip install -r requirements.txt; fi - name: Test with pytest From 5480741db3b436bd22b2b77e44217fb830e35cc7 Mon Sep 17 00:00:00 2001 From: Ben Blaiszik Date: Mon, 4 Oct 2021 23:36:28 -0500 Subject: [PATCH 06/13] Update test_requirements.txt --- test_requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/test_requirements.txt b/test_requirements.txt index 2ca9874..7aa8cf8 100644 --- a/test_requirements.txt +++ b/test_requirements.txt @@ -9,3 +9,4 @@ nbval>=0.9.4 pytest>=5.3.1 pytest-cov>=2.5.1 sphinx_bootstrap_theme>=0.6.5 +globus_sdk==2.0.1 From adbc67b12233c0cab9c2f19559828b1c10bc8d9c Mon Sep 17 00:00:00 2001 From: Ben Blaiszik Date: Mon, 4 Oct 2021 23:45:27 -0500 Subject: [PATCH 07/13] Update testing-work.yml --- .github/workflows/testing-work.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/testing-work.yml b/.github/workflows/testing-work.yml index cb29264..f253fb1 100644 --- a/.github/workflows/testing-work.yml +++ b/.github/workflows/testing-work.yml @@ -34,7 +34,8 @@ jobs: pip install pytest-cov pip install -e . pip install -r test_requirements.txt - if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + pip uninstall globus-sdk + pip install globus-sdk==2.0.1 - name: Test with pytest run: | From 6000b98dec50e4039f619c7b4e7b73c20935b8ce Mon Sep 17 00:00:00 2001 From: Ben Blaiszik Date: Mon, 4 Oct 2021 23:47:59 -0500 Subject: [PATCH 08/13] Update testing-work.yml --- .github/workflows/testing-work.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/testing-work.yml b/.github/workflows/testing-work.yml index f253fb1..1256406 100644 --- a/.github/workflows/testing-work.yml +++ b/.github/workflows/testing-work.yml @@ -34,7 +34,6 @@ jobs: pip install pytest-cov pip install -e . pip install -r test_requirements.txt - pip uninstall globus-sdk pip install globus-sdk==2.0.1 - name: Test with pytest From 9c64dcc2a5455ea39b9e03028c4a1bbac540a317 Mon Sep 17 00:00:00 2001 From: Ben Blaiszik Date: Mon, 4 Oct 2021 23:51:06 -0500 Subject: [PATCH 09/13] Update testing-work.yml --- .github/workflows/testing-work.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/testing-work.yml b/.github/workflows/testing-work.yml index 1256406..f3ebf22 100644 --- a/.github/workflows/testing-work.yml +++ b/.github/workflows/testing-work.yml @@ -14,7 +14,7 @@ jobs: timeout-minutes: 20 strategy: matrix: - python-version: [3.7, 3.8, 3.9] + python-version: [3.9] env: CLIENT_ID: ${{ secrets.CLIENT_ID }} @@ -34,7 +34,7 @@ jobs: pip install pytest-cov pip install -e . pip install -r test_requirements.txt - pip install globus-sdk==2.0.1 + pip install globus-sdk==1.11.0 - name: Test with pytest run: | From 984e1c932993c8f4e9a6fe3bbf7f547d8ebe2b82 Mon Sep 17 00:00:00 2001 From: Ben Blaiszik Date: Mon, 4 Oct 2021 23:55:21 -0500 Subject: [PATCH 10/13] Update testing-work.yml --- .github/workflows/testing-work.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/testing-work.yml b/.github/workflows/testing-work.yml index f3ebf22..dfd2311 100644 --- a/.github/workflows/testing-work.yml +++ b/.github/workflows/testing-work.yml @@ -35,6 +35,7 @@ jobs: pip install -e . pip install -r test_requirements.txt pip install globus-sdk==1.11.0 + pip install globus-nexus-client==0.3.0 - name: Test with pytest run: | From 36a02fdb453fe9cce0853ab99668dc61e075a194 Mon Sep 17 00:00:00 2001 From: Ben Blaiszik Date: Tue, 5 Oct 2021 10:33:35 -0500 Subject: [PATCH 11/13] adding some logging --- .github/workflows/testing-work.yml | 2 +- tests/test_connect_client.py | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/testing-work.yml b/.github/workflows/testing-work.yml index 078d5d9..4db10f2 100644 --- a/.github/workflows/testing-work.yml +++ b/.github/workflows/testing-work.yml @@ -11,7 +11,7 @@ jobs: build: runs-on: ubuntu-latest - timeout-minutes: 20 + timeout-minutes: 5 strategy: matrix: python-version: [3.7, 3.8, 3.9] diff --git a/tests/test_connect_client.py b/tests/test_connect_client.py index 76f934b..e5986f6 100644 --- a/tests/test_connect_client.py +++ b/tests/test_connect_client.py @@ -12,6 +12,7 @@ client_id = os.getenv('CLIENT_ID') client_secret = os.getenv('CLIENT_SECRET') + services= [ "data_mdf", "mdf_connect", @@ -20,10 +21,14 @@ "transfer", "openid"] +print(services) + res_cred = mdf_toolbox.confidential_login(client_id=client_id, client_secret=client_secret, services=services, make_clients=True) +print(res_cred) + authorizer = res_cred['mdf_connect'] From 073e69d842547605bfffcbbf850671fd94c0cf0f Mon Sep 17 00:00:00 2001 From: Ben Blaiszik Date: Fri, 10 Dec 2021 10:33:37 -0600 Subject: [PATCH 12/13] Updating tests, auth, Globus SDK --- mdf_connect_client/mdfcc.py | 2 +- mdf_connect_client/version.py | 2 +- requirements.txt | 3 ++- tests/test_connect_client.py | 3 --- 4 files changed, 4 insertions(+), 6 deletions(-) diff --git a/mdf_connect_client/mdfcc.py b/mdf_connect_client/mdfcc.py index f69fd9f..f15a3f8 100644 --- a/mdf_connect_client/mdfcc.py +++ b/mdf_connect_client/mdfcc.py @@ -800,7 +800,7 @@ def submit_dataset(self, update=False, submission=None, reset=False): # Make the request headers = {} - self.__authorizer.set_authorization_header(headers) + self.__authorizer.get_authorization_header(headers) res = requests.post(self.service_loc+self.extract_route, json=submission, headers=headers) # Handle first 401/403 by regenerating auth headers diff --git a/mdf_connect_client/version.py b/mdf_connect_client/version.py index a2d1760..fc0f611 100644 --- a/mdf_connect_client/version.py +++ b/mdf_connect_client/version.py @@ -1,2 +1,2 @@ # Single source of truth for package version -__version__ = "0.3.8" +__version__ = "0.3.9" diff --git a/requirements.txt b/requirements.txt index 6aacc23..0bf56a9 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,5 @@ -mdf-toolbox>=0.5.0 +mdf-toolbox>=0.5.9 +globus_sdk==3.2.0 nameparser>=1.0.4 requests>=2.18.4 jsonschema \ No newline at end of file diff --git a/tests/test_connect_client.py b/tests/test_connect_client.py index e5986f6..db1c822 100644 --- a/tests/test_connect_client.py +++ b/tests/test_connect_client.py @@ -21,13 +21,10 @@ "transfer", "openid"] -print(services) - res_cred = mdf_toolbox.confidential_login(client_id=client_id, client_secret=client_secret, services=services, make_clients=True) -print(res_cred) authorizer = res_cred['mdf_connect'] From 7abacc580c59c149b8f10d123122a2e3e1f46c60 Mon Sep 17 00:00:00 2001 From: Ben Blaiszik Date: Fri, 10 Dec 2021 12:39:56 -0600 Subject: [PATCH 13/13] Updating version, updating header setting --- mdf_connect_client/mdfcc.py | 28 ++++++++++++++-------------- mdf_connect_client/version.py | 2 +- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/mdf_connect_client/mdfcc.py b/mdf_connect_client/mdfcc.py index f15a3f8..917d73f 100644 --- a/mdf_connect_client/mdfcc.py +++ b/mdf_connect_client/mdfcc.py @@ -800,13 +800,13 @@ def submit_dataset(self, update=False, submission=None, reset=False): # Make the request headers = {} - self.__authorizer.get_authorization_header(headers) + self.__authorizer.get_authorization_header() res = requests.post(self.service_loc+self.extract_route, json=submission, headers=headers) # Handle first 401/403 by regenerating auth headers if res.status_code == 401 or res.status_code == 403: self.__authorizer.handle_missing_authorization() - self.__authorizer.set_authorization_header(headers) + headers["Authorization"] = self.__authorizer.get_authorization_header() res = requests.post(self.service_loc+self.extract_route, json=submission, headers=headers) @@ -881,13 +881,13 @@ def submit_dataset_metadata_update(self, source_id, metadata_update=None, reset= # Make the request headers = {} - self.__authorizer.set_authorization_header(headers) + headers["Authorization"] = self.__authorizer.get_authorization_header() res = requests.post(self.service_loc+self.md_update_route+source_id, json=metadata_update, headers=headers) # Handle first 401/403 by regenerating auth headers if res.status_code == 401 or res.status_code == 403: self.__authorizer.handle_missing_authorization() - self.__authorizer.set_authorization_header(headers) + headers["Authorization"] = self.__authorizer.get_authorization_header() res = requests.post(self.service_loc+self.md_update_route+source_id, json=metadata_update, headers=headers) @@ -945,13 +945,13 @@ def check_status(self, source_id=None, short=False, raw=False): print("Error: No dataset submitted") return None headers = {} - self.__authorizer.set_authorization_header(headers) + headers["Authorization"] = self.__authorizer.get_authorization_header() res = requests.get(self.service_loc+self.status_route+(source_id or self.source_id), headers=headers) # Handle first 401/403 by regenerating auth headers if res.status_code == 401 or res.status_code == 403: self.__authorizer.handle_missing_authorization() - self.__authorizer.set_authorization_header(headers) + headers["Authorization"] = self.__authorizer.get_authorization_header() res = requests.get(self.service_loc+self.status_route+(source_id or self.source_id), headers=headers) @@ -1079,7 +1079,7 @@ def check_all_submissions(self, verbose=False, active_only=False, include_tests= filters.append(("submission_time", "<=", older_than_date.isoformat("T") + "Z")) headers = {} - self.__authorizer.set_authorization_header(headers) + headers["Authorization"] = self.__authorizer.get_authorization_header() body = { "filters": filters } @@ -1088,7 +1088,7 @@ def check_all_submissions(self, verbose=False, active_only=False, include_tests= # Handle first 401/403 by regenerating auth headers if res.status_code == 401 or res.status_code == 403: self.__authorizer.handle_missing_authorization() - self.__authorizer.set_authorization_header(headers) + headers["Authorization"] = self.__authorizer.get_authorization_header() res = requests.post(url, headers=headers, json=body) try: @@ -1169,12 +1169,12 @@ def get_curation_task(self, source_id, summary=False, raw=False): if raw is ``True``, *dict*: The full task results. """ headers = {} - self.__authorizer.set_authorization_header(headers) + headers["Authorization"] = self.__authorizer.get_authorization_header() res = requests.get(self.service_loc+self.curation_route+source_id, headers=headers) # Handle first 401/403 by regenerating auth headers if res.status_code == 401 or res.status_code == 403: self.__authorizer.handle_missing_authorization() - self.__authorizer.set_authorization_header(headers) + headers["Authorization"] = self.__authorizer.get_authorization_header() res = requests.get(self.service_loc+self.curation_route+source_id, headers=headers) try: @@ -1239,13 +1239,13 @@ def get_available_curation_tasks(self, summary=True, raw=False, _admin_code=None if raw is ``True``, *dict*: The full task results. """ headers = {} - self.__authorizer.set_authorization_header(headers) + headers["Authorization"] = self.__authorizer.get_authorization_header() res = requests.get(self.service_loc+self.all_curation_route+(_admin_code or ""), headers=headers) # Handle first 401/403 by regenerating auth headers if res.status_code == 401 or res.status_code == 403: self.__authorizer.handle_missing_authorization() - self.__authorizer.set_authorization_header(headers) + headers["Authorization"] = self.__authorizer.get_authorization_header() res = requests.get(self.service_loc+self.all_curation_route+(_admin_code or ""), headers=headers) try: @@ -1383,13 +1383,13 @@ def _complete_curation_task(self, source_id, verdict, reason, prompt=True, raw=F "reason": reason } headers = {} - self.__authorizer.set_authorization_header(headers) + headers["Authorization"] = self.__authorizer.get_authorization_header() res = requests.post(self.service_loc+self.curation_route+source_id, headers=headers, json=command) # Handle first 401/403 by regenerating auth headers if res.status_code == 401 or res.status_code == 403: self.__authorizer.handle_missing_authorization() - self.__authorizer.set_authorization_header(headers) + headers["Authorization"] = self.__authorizer.get_authorization_header() res = requests.get(self.service_loc+self.curation_route+source_id, headers=headers, json=command) diff --git a/mdf_connect_client/version.py b/mdf_connect_client/version.py index fc0f611..a3d4e55 100644 --- a/mdf_connect_client/version.py +++ b/mdf_connect_client/version.py @@ -1,2 +1,2 @@ # Single source of truth for package version -__version__ = "0.3.9" +__version__ = "0.3.10"