5
5
import logging
6
6
import email
7
7
import six
8
- from urllib3 .filepost import choose_boundary
9
8
from io import BytesIO
10
9
from collections import OrderedDict
11
10
if sys .version_info .major < 3 :
@@ -400,9 +399,9 @@ def _http_get(self, url, params, headers):
400
399
'''
401
400
url += self ._build_query_string (params )
402
401
logger .debug ('GET: {}' .format (url ))
403
- resp = self ._session .get (url = url , headers = headers )
404
- resp .raise_for_status ()
405
- return resp
402
+ response = self ._session .get (url = url , headers = headers )
403
+ response .raise_for_status ()
404
+ return response
406
405
407
406
def _http_get_application_json (self , url , ** params ):
408
407
'''Performs a HTTP GET request that accepts "applicaton/dicom+json"
@@ -532,10 +531,7 @@ def _http_get_multipart_application_dicom(self, url, **params):
532
531
DICOM data sets
533
532
534
533
'''
535
- content_type = (
536
- 'multipart/related; type="application/dicom"; '
537
- 'boundary="--{boundary}"' .format (boundary = choose_boundary ())
538
- )
534
+ content_type = 'multipart/related; type="application/dicom"'
539
535
resp = self ._http_get (url , params , {'Accept' : content_type })
540
536
datasets = self ._decode_multipart_message (resp .content , resp .headers )
541
537
return [pydicom .dcmread (BytesIO (ds )) for ds in datasets ]
@@ -557,10 +553,7 @@ def _http_get_multipart_application_octet_stream(self, url, **params):
557
553
content of HTTP message body parts
558
554
559
555
'''
560
- content_type = (
561
- 'multipart/related; type="application/octet-stream"; '
562
- 'boundary="--{boundary}"' .format (boundary = choose_boundary ())
563
- )
556
+ content_type = 'multipart/related; type="application/octet-stream"'
564
557
resp = self ._http_get (url , params , {'Accept' : content_type })
565
558
return self ._decode_multipart_message (resp .content , resp .headers )
566
559
@@ -587,11 +580,8 @@ def _http_get_multipart_image(self, url, image_format, **params):
587
580
raise ValueError (
588
581
'Image format "{}" is not supported.' .format (image_format )
589
582
)
590
- content_type = (
591
- 'multipart/related; type="image/{image_format}"; '
592
- 'boundary="--{boundary}"' .format (
593
- image_format = image_format , boundary = choose_boundary ()
594
- )
583
+ content_type = 'multipart/related; type="image/{image_format}"' .format (
584
+ image_format = image_format
595
585
)
596
586
resp = self ._http_get (url , params , {'Accept' : content_type })
597
587
return self ._decode_multipart_message (resp .content , resp .headers )
0 commit comments