@@ -32,6 +32,8 @@ class URISuffix(enum.Enum):
3232# `GoogleCloudHealthcare`.
3333_REGEX_ID_2 = r'[\w.-]+'
3434_ATTR_VALIDATOR_ID_2 = attr .validators .matches_re (_REGEX_ID_2 )
35+ # The URL for the Google Cloud Healthcare API endpoint.
36+ _CHC_API_URL = 'https://healthcare.googleapis.com/v1'
3537
3638
3739class URI :
@@ -481,15 +483,12 @@ class GoogleCloudHealthcare:
481483 dataset_id = attr .ib (type = str , validator = _ATTR_VALIDATOR_ID_2 )
482484 dicom_store_id = attr .ib (type = str , validator = _ATTR_VALIDATOR_ID_2 )
483485
484- # The URL for the CHC API endpoint.
485- _API_URL = 'https://healthcare.googleapis.com/v1'
486-
487486 def __str__ (self ) -> str :
488487 """Returns a string URL for use as :py:attr:`URI.base_url`.
489488
490489 See class docstring for the returned URL format.
491490 """
492- return (f'{ self . _API_URL } /'
491+ return (f'{ _CHC_API_URL } /'
493492 f'projects/{ self .project_id } /'
494493 f'locations/{ self .location } /'
495494 f'datasets/{ self .dataset_id } /'
@@ -513,9 +512,9 @@ def from_url(cls, base_url: str) -> 'GoogleCloudHealthcare':
513512 If ``base_url`` does not match the specifications in the class
514513 docstring.
515514 """
516- if not base_url .startswith (f'{ cls . _API_URL } /' ):
515+ if not base_url .startswith (f'{ _CHC_API_URL } /' ):
517516 raise ValueError ('Invalid CHC API v1 URL: {base_url!r}' )
518- resource_suffix = base_url [len (cls . _API_URL ) + 1 :]
517+ resource_suffix = base_url [len (_CHC_API_URL ) + 1 :]
519518
520519 store_regex = (r'projects/(%s)/locations/(%s)/datasets/(%s)/'
521520 r'dicomStores/(%s)/dicomWeb$' ) % (
0 commit comments