Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions cdmtaskservice/jaws/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@


import aiohttp
import aiohttp_socks
import datetime
from enum import Enum
import logging
import os
from typing import Any

from cdmtaskservice.arg_checkers import require_string as _require_string, not_falsy as _not_falsy
Expand Down Expand Up @@ -64,11 +66,16 @@ def __init__(self, url: str, token: str):
if not url.endswith("/"):
url += "/"
url += "api/v2/"
self._sess = aiohttp.ClientSession(
base_url=url,
headers={"Authorization": f"Bearer {_require_string(token, 'token')}"}
)
headers = {"Authorization": f"Bearer {_require_string(token, 'token')}"}
self._logr = logging.getLogger(__name__)
pxurl = os.environ.get("JAWS_HTTPS_PROXY")
if pxurl:
# just used for testing so not advertised for now
self._logr.info(f"Using proxy {pxurl}")
proxy = aiohttp_socks.ProxyConnector.from_url(pxurl)
self._sess = aiohttp.ClientSession(base_url=url, headers=headers, connector=proxy)
else:
self._sess = aiohttp.ClientSession(base_url=url, headers=headers)

async def _get(self, url, params=None) -> dict[str, Any]:
return await self._req("GET", url, params=params)
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ services:
- KBCTS_JOB_MAX_CPU_HOURS=200
- KBCTS_KAFKA_BOOTSTRAP_SERVERS=kafka:9092
- KBCTS_KAFKA_TOPIC_JOBS=cts-jobs
- KBCTS_SERVICE_ROOT_URL=https://cdm_task_service:5000
- KBCTS_SERVICE_ROOT_URL=http://cdm_task_service:5000
- KBCTS_SERVICE_GROUP=local_development
volumes:
- ./tmp_creds:/creds
Expand Down
2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ dependencies = [
"aiobotocore==3.1.0",
"aiofiles==25.1.0",
"aiohttp==3.13.3",
"aiohttp-socks==0.11.0",
"aiokafka==0.12.0",
"apscheduler==3.11.2",
"async-lru==2.0.5",
"awscrt==0.31.0",
"bidict==0.23.1",
Expand Down
61 changes: 60 additions & 1 deletion uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading