Update services.py

This commit is contained in:
Joshua Hare 2025-08-12 21:29:13 +10:00
parent 9729004982
commit 5f4e1b7207

View File

@ -11,7 +11,7 @@ from flask import current_app, Blueprint, request, jsonify
from fhirpathpy import evaluate from fhirpathpy import evaluate
from collections import defaultdict, deque from collections import defaultdict, deque
from pathlib import Path from pathlib import Path
from urllib.parse import quote, urlparse from urllib.parse import quote, urlparse, urljoin
from types import SimpleNamespace from types import SimpleNamespace
import datetime import datetime
import subprocess import subprocess
@ -4607,7 +4607,8 @@ def retrieve_bundles(fhir_server_url, resources, output_zip, validate_references
# Fetch Initial Bundles # Fetch Initial Bundles
initial_bundle_files = [] initial_bundle_files = []
for resource_type in resources: for resource_type in resources:
url = f"{base_proxy_url}/{quote(resource_type)}" #url = f"{base_proxy_url}/{quote(resource_type)}"
url = urljoin(base_proxy_url, quote(resource_type))
yield json.dumps({"type": "progress", "message": f"Fetching bundle for {resource_type} via proxy..."}) + "\n" yield json.dumps({"type": "progress", "message": f"Fetching bundle for {resource_type} via proxy..."}) + "\n"
logger.debug(f"Sending GET request to proxy {url} with headers: {json.dumps(headers)}") logger.debug(f"Sending GET request to proxy {url} with headers: {json.dumps(headers)}")
try: try: