From df6b5dc292e83664b333201af15b806366075318 Mon Sep 17 00:00:00 2001 From: Jun Aishima Date: Tue, 1 Oct 2024 17:12:56 -0400 Subject: [PATCH 1/2] use a session instead of requests directly * enable persistent sessions to be used instead of an always-new session for each request --- analysisstore/client/asutils.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/analysisstore/client/asutils.py b/analysisstore/client/asutils.py index 052e4e0..ceebd1e 100644 --- a/analysisstore/client/asutils.py +++ b/analysisstore/client/asutils.py @@ -5,8 +5,11 @@ import six +session = requests.Session() + + def get_document(url, doc_type, as_json, contents): - r = requests.get(url, params=ujson.dumps(contents)) + r = session.get(url, params=ujson.dumps(contents)) r.raise_for_status() content = ujson.loads(r.text) if as_json: @@ -18,7 +21,7 @@ def get_document(url, doc_type, as_json, contents): def post_document(url, contents): try: - r = requests.post(url, data=ujson.dumps(contents)) + r = session.post(url, data=ujson.dumps(contents)) except ConnectionError: raise ConnectionError('No AnalysisStore server found') r.raise_for_status() # this is for catching server side issue. From ad4fe9a6e58432eba7b196cb355b600e7deecbf5 Mon Sep 17 00:00:00 2001 From: Jun Aishima Date: Tue, 8 Oct 2024 14:12:18 -0400 Subject: [PATCH 2/2] update versions, for conda test, install mongomock via pip * after mongomock infrastructure upgrade, python3.8 is minimum. since this is only available via pip, install only this package via pip in the conda environment setup --- .github/workflows/testing.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 7f88111..9cab370 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -12,7 +12,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ["3.6", "3.7", "3.8", "3.9", "3.10", "3.11"] + python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] dependencies: ["pip", "conda"] fail-fast: false @@ -53,7 +53,8 @@ jobs: if: matrix.dependencies == 'conda' run: | set -vxeo pipefail - conda install -y -c conda-forge six mongoquery doct jsonschema mock mongomock pymongo pytest pyyaml requests tornado ujson + conda install -y -c conda-forge six mongoquery doct jsonschema mock pymongo pytest pyyaml requests tornado ujson + pip install mongomock - name: Install the package run: |