Skip to content

Commit 78d85e9

Browse files
authored
Merge pull request #46 from pavlushkin/add-app-to-request
Add app object to request and support for custom AidboxClient class
2 parents 3e127fd + c2e5229 commit 78d85e9

File tree

8 files changed

+871
-669
lines changed

8 files changed

+871
-669
lines changed

.github/workflows/build.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ jobs:
3030
- name: Run tests
3131
run: ./run_test.sh
3232
shell: bash
33+
- name: Show logs
34+
if: ${{ failure() }}
35+
run: docker-compose logs
3336
# - name: Upload coverage to Codecov
3437
# uses: codecov/codecov-action@v3
3538
# with:

Dockerfile

+1-3
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@ WORKDIR /app
88
COPY Pipfile Pipfile.lock ./
99
RUN pipenv install --dev
1010

11-
# SQLAlchemy vulnerability - https://pyup.io/v/51668/742
12-
# Remove ignore option once fix is released or upgrade to version 2
13-
RUN pipenv check -i 51668
11+
RUN pipenv check
1412
COPY . .
1513

1614
EXPOSE 8081

Pipfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ name = "pypi"
55

66
[packages]
77
aiohttp = "~=3.8.3"
8-
sqlalchemy = "~=1.4.45"
8+
sqlalchemy = "~=2.0.5"
99
fhirpy = "~=1.3.0"
1010
coloredlogs = "*"
1111
jsonschema = "~=4.17.3"

Pipfile.lock

+859-663
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

aidbox_python_sdk/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
__title__ = "aidbox-python-sdk"
2-
__version__ = "0.1.2"
2+
__version__ = "0.1.3"
33
__author__ = "beda.software"
44
__license__ = "None"
55
__copyright__ = "Copyright 2023 beda.software"

aidbox_python_sdk/handlers.py

+1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ async def operation(request, data):
3535
logger.error("Operation handler `%s` was not found", data["handler"])
3636
raise web.HTTPNotFound()
3737
try:
38+
data["request"]["app"] = request.app
3839
result = handler(data["operation"], data["request"])
3940
if asyncio.iscoroutine(result):
4041
try:

aidbox_python_sdk/main.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,13 @@ async def register_app(sdk: SDK, client: AsyncAidboxClient):
5151

5252

5353
async def init_client(settings: Settings):
54+
AidboxClient = settings.AIDBOX_CLIENT_CLASS
5455
basic_auth = BasicAuth(
5556
login=settings.APP_INIT_CLIENT_ID,
5657
password=settings.APP_INIT_CLIENT_SECRET,
5758
)
5859

59-
return AsyncAidboxClient(
60+
return AidboxClient(
6061
"{}".format(settings.APP_INIT_URL), authorization=basic_auth.encode()
6162
)
6263

aidbox_python_sdk/settings.py

+3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import os
22
from pathlib import Path
33

4+
from .aidboxpy import AsyncAidboxClient
5+
46

57
class Required:
68
def __init__(self, v_type=None):
@@ -30,6 +32,7 @@ class Settings:
3032
APP_SECRET = Required(v_type=str)
3133
AIO_HOST = Required(v_type=str)
3234
AIO_PORT = Required(v_type=str)
35+
AIDBOX_CLIENT_CLASS = AsyncAidboxClient
3336

3437
def __init__(self, **custom_settings):
3538
"""

0 commit comments

Comments
 (0)