SMART on FHIR Python Client 4.3.1
 
Loading...
Searching...
No Matches
fhirclient._utils Namespace Reference

Functions

Optional[ 'Bundle'] _fetch_next_page ('Bundle' bundle, 'FHIRServer' server)
 Fetch the next page of results using the next link provided in the bundle.
 
Optional[str] _get_next_link ('Bundle' bundle)
 Extract the next link from the Bundle's links.
 
str _sanitize_next_link (str next_link)
 Sanitize the next link by validating its scheme and hostname against the origin server.
 
'Bundle_execute_pagination_request (str sanitized_url, 'FHIRServer' server)
 Execute the request to retrieve the next page using the sanitized URL via Bundle.read_from.
 
Iterator[ 'Bundle'] iter_pages ('Bundle' first_bundle, 'FHIRServer' server)
 Iterator that yields each page of results as a FHIR Bundle.
 

Function Documentation

◆ _execute_pagination_request()

'Bundle' fhirclient._utils._execute_pagination_request ( str  sanitized_url,
'FHIRServer server 
)
protected

Execute the request to retrieve the next page using the sanitized URL via Bundle.read_from.

Parameters
sanitized_urlThe sanitized URL to fetch the next page.
serverThe FHIR server instance to perform the request.
Returns
Bundle The next page of results as a FHIR Bundle.
Exceptions
HTTPErrorIf the request fails due to network issues or server errors.

◆ _fetch_next_page()

Optional['Bundle'] fhirclient._utils._fetch_next_page ( 'Bundle bundle,
'FHIRServer server 
)
protected

Fetch the next page of results using the next link provided in the bundle.

Parameters
bundleThe FHIR Bundle containing the next link.
serverThe FHIR server instance for handling requests and authentication.
Returns
Optional The next page of results as a FHIR Bundle, or None if no "next" link is found.

◆ _get_next_link()

Optional[str] fhirclient._utils._get_next_link ( 'Bundle bundle)
protected

Extract the next link from the Bundle's links.

Parameters
bundleThe FHIR Bundle containing pagination links.
Returns
Optional The URL of the next page if available, None otherwise.

◆ _sanitize_next_link()

str fhirclient._utils._sanitize_next_link ( str  next_link)
protected

Sanitize the next link by validating its scheme and hostname against the origin server.

This function ensures the next link URL uses a valid scheme (http or https) and that it contains a hostname. This provides a basic safeguard against malformed URLs without overly restricting flexibility.

Parameters
next_linkThe raw next link URL.
Returns
str The validated URL.
Exceptions
ValueErrorIf the URL's scheme is not `http` or `https`, or if the hostname does not match the origin server.

◆ iter_pages()

Iterator['Bundle'] fhirclient._utils.iter_pages ( 'Bundle first_bundle,
'FHIRServer server 
)

Iterator that yields each page of results as a FHIR Bundle.

Parameters
first_bundleThe first Bundle to start pagination.
serverThe FHIR server instance to perform the request.
Returns
Bundle Each page of results as a FHIR Bundle.