Skip to content

Commit 4badd40

Browse files
author
hackermd
committed
Use logging.warning instead of loggin.warn
1 parent f52309e commit 4badd40

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

src/dicomweb_client/api.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -91,13 +91,12 @@ def _create_dataelement(tag, vr, value):
9191
elem_value.append(ds)
9292
elif vr == 'PN':
9393
# Special case, see DICOM Part 18 Annex F2.2
94-
# http://dicom.nema.org/medical/dicom/current/output/html/part18.html#sect_F.2.2
9594
elem_value = []
9695
for v in value:
9796
if not isinstance(v, dict):
9897
# Some DICOMweb services get this wrong, so we workaround it
9998
# and issue a warning rather than raising an error.
100-
logger.warn(
99+
logger.warning(
101100
'attribute with VR Person Name (PN) is not '
102101
'formatted correctly'
103102
)
@@ -120,8 +119,7 @@ def _create_dataelement(tag, vr, value):
120119
else:
121120
elem_value = value
122121
if value is None:
123-
# TODO: check if mandatory
124-
logger.warn('missing value for data element "{}"'.format(tag))
122+
logger.warning('missing value for data element "{}"'.format(tag))
125123
try:
126124
return pydicom.dataelem.DataElement(tag=tag, value=elem_value, VR=vr)
127125
except Exception:
@@ -348,7 +346,7 @@ def _get_series_url(self, service, study_instance_uid=None,
348346
url += '/series'
349347
else:
350348
if series_instance_uid is not None:
351-
logger.warn(
349+
logger.warning(
352350
'series UID is ignored because study UID is undefined'
353351
)
354352
url = '{service_url}/series'
@@ -368,7 +366,7 @@ def _get_instances_url(self, service, study_instance_uid=None,
368366
url += '/{sop_instance_uid}'
369367
else:
370368
if sop_instance_uid is not None:
371-
logger.warn(
369+
logger.warning(
372370
'SOP Instance UID is ignored because Study/Series '
373371
'Instance UID are undefined'
374372
)
@@ -417,12 +415,12 @@ def _http_get(self, url, params, headers):
417415
except requests.exceptions.HTTPError as error:
418416
raise HTTPError(error)
419417
if response.status_code == 204:
420-
logger.warn('empty response')
418+
logger.warning('empty response')
421419
# The server may not return all results, but rather include a warning
422420
# header to notify that client that there are remaining results.
423421
# (see DICOM Part 3.18 Section 6.7.1.2)
424422
if 'Warning' in response.headers:
425-
logger.warn(response.headers['Warning'])
423+
logger.warning(response.headers['Warning'])
426424
return response
427425

428426
def _http_get_application_json(self, url, **params):

0 commit comments

Comments
 (0)